<br><tt><font size=2>Hello Tziporet!</font></tt>
<br><tt><font size=2>Below is a patch of ehca against the ofed git tree
branch ehca-branch in order to upgrade it to the same code level of Roland's
git tree branch for-2.6.19, which has been posted for a while. The main
code changes are:</font></tt>
<br><tt><font size=2>- Replace the "huge" EDEB macro by a simpler
wrapper based on dev_err/dbg</font></tt>
<br><tt><font size=2>- Remove superfluous variables initialization and
arguments checking<br>
- Replace struct ehca_module by static member variables in appropriate
files, where they are accessed</font></tt>
<br><tt><font size=2>- Rename module name to ib_ehca.ko</font></tt>
<br><tt><font size=2>Thanks!</font></tt>
<br><tt><font size=2>Nam Nguyen</font></tt>
<br>
<br>
<br><tt><font size=2>Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com><br>
---</font></tt>
<br>
<br><tt><font size=2> Kconfig |
14 </font></tt>
<br><tt><font size=2> Makefile |
9 </font></tt>
<br><tt><font size=2> ehca_av.c | 128 ++----</font></tt>
<br><tt><font size=2> ehca_classes.h | 27 -</font></tt>
<br><tt><font size=2> ehca_cq.c | 222 +++++------</font></tt>
<br><tt><font size=2> ehca_eq.c | 71 ---</font></tt>
<br><tt><font size=2> ehca_hca.c | 103 +----</font></tt>
<br><tt><font size=2> ehca_irq.c | 221 +++--------</font></tt>
<br><tt><font size=2> ehca_main.c | 491 ++++++++----------------</font></tt>
<br><tt><font size=2> ehca_mcast.c | 119 +----</font></tt>
<br><tt><font size=2> ehca_mrmw.c | 1113 ++++++++++++++++++++++----------------------------------</font></tt>
<br><tt><font size=2> ehca_mrmw.h | 3 </font></tt>
<br><tt><font size=2> ehca_pd.c | 60 +--</font></tt>
<br><tt><font size=2> ehca_qp.c | 572 ++++++++++++----------------</font></tt>
<br><tt><font size=2> ehca_reqs.c | 219 ++++-------</font></tt>
<br><tt><font size=2> ehca_sqp.c | 50 --</font></tt>
<br><tt><font size=2> ehca_tools.h | 337 ++--------------</font></tt>
<br><tt><font size=2> ehca_uverbs.c | 278 ++++++-------</font></tt>
<br><tt><font size=2> hcp_if.c | 834
++++++++++++-----------------------------</font></tt>
<br><tt><font size=2> hcp_phyp.c | 26 -</font></tt>
<br><tt><font size=2> hcp_phyp.h | 10 </font></tt>
<br><tt><font size=2> hipz_fns_core.h | 44 --</font></tt>
<br><tt><font size=2> ipz_pt_fn.c | 37 -</font></tt>
<br><tt><font size=2> ipz_pt_fn.h | 7 </font></tt>
<br><tt><font size=2> 24 files changed, 1781 insertions(+), 3214 deletions(-)</font></tt>
<br>
<br>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/Kconfig
linux-2.6/drivers/infiniband/hw/ehca/Kconfig</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/Kconfig
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/Kconfig
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -1,12 +1,16 @@</font></tt>
<br><tt><font size=2> config INFINIBAND_EHCA</font></tt>
<br><tt><font size=2>- tristate "eHCA support"</font></tt>
<br><tt><font size=2>- depends on IBMEBUS &&
INFINIBAND</font></tt>
<br><tt><font size=2>- ---help---</font></tt>
<br><tt><font size=2>- This is a low level device
driver for the IBM GX based Host channel</font></tt>
<br><tt><font size=2>- adapters (HCAs).</font></tt>
<br><tt><font size=2>+ tristate "eHCA
support"</font></tt>
<br><tt><font size=2>+ depends on IBMEBUS
&& INFINIBAND</font></tt>
<br><tt><font size=2>+ ---help---</font></tt>
<br><tt><font size=2>+ This driver supports
the IBM pSeries eHCA InfiniBand adapter.</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ To compile the
driver as a module, choose M here. The module</font></tt>
<br><tt><font size=2>+ will be called
ib_ehca.</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> config INFINIBAND_EHCA_SCALING</font></tt>
<br><tt><font size=2> bool "Scaling
support (EXPERIMENTAL)"</font></tt>
<br><tt><font size=2> depends
on IBMEBUS && INFINIBAND_EHCA && HOTPLUG_CPU &&
EXPERIMENTAL</font></tt>
<br><tt><font size=2> ---help---</font></tt>
<br><tt><font size=2> eHCA scaling
support schedules the CQ callbacks to different CPUs.</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ To enable this
feature choose Y here.</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/Makefile
linux-2.6/drivers/infiniband/hw/ehca/Makefile</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/Makefile
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/Makefile
2006-08-30 20:00:17.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -8,11 +8,10 @@</font></tt>
<br><tt><font size=2> #</font></tt>
<br><tt><font size=2> # This source code is distributed under
a dual license of GPL v2.0 and OpenIB BSD.</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-obj-$(CONFIG_INFINIBAND_EHCA) += hcad_mod.o</font></tt>
<br><tt><font size=2>+obj-$(CONFIG_INFINIBAND_EHCA) += ib_ehca.o</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-hcad_mod-objs = ehca_main.o ehca_hca.o ehca_mcast.o
ehca_pd.o ehca_av.o ehca_eq.o \</font></tt>
<br><tt><font size=2>-
ehca_cq.o ehca_qp.o ehca_sqp.o ehca_mrmw.o ehca_reqs.o
ehca_irq.o \</font></tt>
<br><tt><font size=2>-
ehca_uverbs.o ipz_pt_fn.o hcp_if.o hcp_phyp.o</font></tt>
<br><tt><font size=2>+ib_ehca-objs = ehca_main.o ehca_hca.o ehca_mcast.o
ehca_pd.o ehca_av.o ehca_eq.o \</font></tt>
<br><tt><font size=2>+
ehca_cq.o ehca_qp.o ehca_sqp.o ehca_mrmw.o ehca_reqs.o
ehca_irq.o \</font></tt>
<br><tt><font size=2>+
ehca_uverbs.o ipz_pt_fn.o hcp_if.o hcp_phyp.o</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-CFLAGS += -DEHCA_USE_HCALL -DEHCA_USE_HCALL_KERNEL</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_av.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_av.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_av.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_av.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -42,34 +42,26 @@</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "ehav"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/current.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+static struct kmem_cache *av_cache;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> struct ib_ah *ehca_create_ah(struct ib_pd *pd,
struct ib_ah_attr *ah_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- extern int ehca_static_rate;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_av
*av = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR_P(ah_attr);</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_av
*av;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(pd->device, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p
ah_attr=%p", pd, ah_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- av = kmem_cache_alloc(ehca_module.cache_av,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2>+ av = kmem_cache_alloc(av_cache,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2> if (!av)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Out of memory pd=%p ah_attr=%p",
pd, ah_attr);</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto create_ah_exit0;</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "Out of memory pd=%p
ah_attr=%p",</font></tt>
<br><tt><font size=2>+
pd, ah_attr);</font></tt>
<br><tt><font size=2>+
return ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> av->av.sl
= ah_attr->sl;</font></tt>
<br><tt><font size=2>@@ -89,10 +81,6 @@ struct ib_ah *ehca_create_ah(struct
ib_p</font></tt>
<br><tt><font size=2> } else</font></tt>
<br><tt><font size=2>
av->av.ipd = ehca_static_rate;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "IPD
av->av.ipd set =%x ah_attr->static_rate=%x "</font></tt>
<br><tt><font size=2>-
"shca_ib_rate=%x ",av->av.ipd, ah_attr->static_rate,</font></tt>
<br><tt><font size=2>-
shca->sport[ah_attr->port_num].rate);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> av->av.lnh
= ah_attr->ah_flags;</font></tt>
<br><tt><font size=2> av->av.grh.word_0
= EHCA_BMASK_SET(GRH_IPVERSION_MASK, 6);</font></tt>
<br><tt><font size=2> av->av.grh.word_0
|= EHCA_BMASK_SET(GRH_TCLASS_MASK,</font></tt>
<br><tt><font size=2>@@ -104,7 +92,7 @@ struct ib_ah *ehca_create_ah(struct
ib_p</font></tt>
<br><tt><font size=2> av->av.grh.word_0
|= EHCA_BMASK_SET(GRH_NEXTHEADER_MASK, 0x1B);</font></tt>
<br><tt><font size=2> /* set sgid
in grh.word_1 */</font></tt>
<br><tt><font size=2> if (ah_attr->ah_flags
& IB_AH_GRH) {</font></tt>
<br><tt><font size=2>-
int rc = 0;</font></tt>
<br><tt><font size=2>+
int rc;</font></tt>
<br><tt><font size=2>
struct ib_port_attr port_attr;</font></tt>
<br><tt><font size=2>
union ib_gid gid;</font></tt>
<br><tt><font size=2>
memset(&port_attr, 0, sizeof(port_attr));</font></tt>
<br><tt><font size=2>@@ -112,7 +100,7 @@ struct ib_ah *ehca_create_ah(struct
ib_p</font></tt>
<br><tt><font size=2>
&port_attr);</font></tt>
<br><tt><font size=2>
if (rc) { /* invalid port number */</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
port number "</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Invalid port number "</font></tt>
<br><tt><font size=2>
"ehca_query_port() returned %x "</font></tt>
<br><tt><font size=2>
"pd=%p ah_attr=%p", rc, pd, ah_attr);</font></tt>
<br><tt><font size=2>
goto create_ah_exit1;</font></tt>
<br><tt><font size=2>@@ -123,7 +111,7 @@ struct ib_ah *ehca_create_ah(struct
ib_p</font></tt>
<br><tt><font size=2>
ah_attr->grh.sgid_index, &gid);</font></tt>
<br><tt><font size=2>
if (rc) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Failed
to retrieve sgid "</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Failed to retrieve sgid "</font></tt>
<br><tt><font size=2>
"ehca_query_gid() returned %x "</font></tt>
<br><tt><font size=2>
"pd=%p ah_attr=%p", rc, pd, ah_attr);</font></tt>
<br><tt><font size=2>
goto create_ah_exit1;</font></tt>
<br><tt><font size=2>@@ -137,37 +125,24 @@ struct ib_ah *ehca_create_ah(struct
ib_p</font></tt>
<br><tt><font size=2> memcpy(&av->av.grh.word_3,
&ah_attr->grh.dgid,</font></tt>
<br><tt><font size=2>
sizeof(ah_attr->grh.dgid));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_REGISTER_AV(device,
pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "pd=%p
ah_attr=%p av=%p", pd, ah_attr, av);</font></tt>
<br><tt><font size=2> return &av->ib_ah;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_ah_exit1:</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_av,
av);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-create_ah_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
pd=%p ah_attr=%p", ret, pd, ah_attr);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(av_cache,
av);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ERR_PTR(ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_modify_ah(struct ib_ah *ah, struct
ib_ah_attr *ah_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_av
*av = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_av
*av;</font></tt>
<br><tt><font size=2> struct ehca_ud_av
new_ehca_av;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(ah->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_AV(ah);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ah_attr);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ah=%p
ah_attr=%p", ah, ah_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_pd = container_of(ah->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ah->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -189,33 +164,31 @@ int ehca_modify_ah(struct ib_ah
*ah, str</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* set sgid
in grh.word_1 */</font></tt>
<br><tt><font size=2> if (ah_attr->ah_flags
& IB_AH_GRH) {</font></tt>
<br><tt><font size=2>-
int rc = 0;</font></tt>
<br><tt><font size=2>+
int rc;</font></tt>
<br><tt><font size=2>
struct ib_port_attr port_attr;</font></tt>
<br><tt><font size=2>
union ib_gid gid;</font></tt>
<br><tt><font size=2>
memset(&port_attr, 0, sizeof(port_attr));</font></tt>
<br><tt><font size=2>
rc = ehca_query_port(ah->device, ah_attr->port_num,</font></tt>
<br><tt><font size=2>
&port_attr);</font></tt>
<br><tt><font size=2>
if (rc) { /* invalid port number */</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
port number "</font></tt>
<br><tt><font size=2>+
ehca_err(ah->device,
"Invalid port number "</font></tt>
<br><tt><font size=2>
"ehca_query_port() returned %x "</font></tt>
<br><tt><font size=2>
"ah=%p ah_attr=%p port_num=%x",</font></tt>
<br><tt><font size=2>
rc, ah, ah_attr, ah_attr->port_num);</font></tt>
<br><tt><font size=2>-
goto modify_ah_exit1;</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
memset(&gid, 0, sizeof(gid));</font></tt>
<br><tt><font size=2>
rc = ehca_query_gid(ah->device,</font></tt>
<br><tt><font size=2>
ah_attr->port_num,</font></tt>
<br><tt><font size=2>
ah_attr->grh.sgid_index, &gid);</font></tt>
<br><tt><font size=2>
if (rc) {</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Failed
to retrieve sgid "</font></tt>
<br><tt><font size=2>+
ehca_err(ah->device,
"Failed to retrieve sgid "</font></tt>
<br><tt><font size=2>
"ehca_query_gid() returned %x "</font></tt>
<br><tt><font size=2>
"ah=%p ah_attr=%p port_num=%x "</font></tt>
<br><tt><font size=2>
"sgid_index=%x",</font></tt>
<br><tt><font size=2>
rc, ah, ah_attr, ah_attr->port_num,</font></tt>
<br><tt><font size=2>
ah_attr->grh.sgid_index);</font></tt>
<br><tt><font size=2>-
goto modify_ah_exit1;</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
memcpy(&new_ehca_av.grh.word_1, &gid,
sizeof(gid));</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -228,33 +201,22 @@ int ehca_modify_ah(struct ib_ah
*ah, str</font></tt>
<br><tt><font size=2> av = container_of(ah,
struct ehca_av, ib_ah);</font></tt>
<br><tt><font size=2> av->av
= new_ehca_av;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-modify_ah_exit1:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
ah=%p ah_attr=%p", ret, ah, ah_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr
*ah_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_av
*av = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_av
*av = container_of(ah, struct ehca_av, ib_ah);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(ah->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_AV(ah);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ah_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ah=%p
ah_attr=%p", ah, ah_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_pd = container_of(ah->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ah->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- av = container_of(ah,
struct ehca_av, ib_ah);</font></tt>
<br><tt><font size=2> memcpy(&ah_attr->grh.dgid,
&av->av.grh.word_3,</font></tt>
<br><tt><font size=2>
sizeof(ah_attr->grh.dgid));</font></tt>
<br><tt><font size=2> ah_attr->sl
= av->av.sl;</font></tt>
<br><tt><font size=2>@@ -271,33 +233,39 @@ int ehca_query_ah(struct ib_ah
*ah, stru</font></tt>
<br><tt><font size=2> ah_attr->grh.flow_label
= EHCA_BMASK_GET(GRH_FLOWLABEL_MASK,</font></tt>
<br><tt><font size=2>
av->av.grh.word_0);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ah=%p
ah_attr=%p ret=%x", ah, ah_attr, ret);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_destroy_ah(struct ib_ah *ah)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(ah->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_AV(ah);</font></tt>
<br><tt><font size=2>- EHCA_DEREGISTER_AV(ah);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ah=%p",
ah);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- my_pd = container_of(ah->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ah->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_av,</font></tt>
<br><tt><font size=2>-
container_of(ah,
struct ehca_av, ib_ah));</font></tt>
<br><tt><font size=2>+ kmem_cache_free(av_cache,
container_of(ah, struct ehca_av, ib_ah));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
ah=%p", ret, ah);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+int ehca_init_av_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ av_cache = kmem_cache_create("ehca_cache_av",</font></tt>
<br><tt><font size=2>+
sizeof(struct ehca_av), 0,</font></tt>
<br><tt><font size=2>+
SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>+
NULL, NULL);</font></tt>
<br><tt><font size=2>+ if (!av_cache)</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+void ehca_cleanup_av_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ if (av_cache)</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(av_cache);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_classes.h
linux-2.6/drivers/infiniband/hw/ehca/ehca_classes.h</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_classes.h
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_classes.h
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -63,18 +63,6 @@ struct ehca_av;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_irq.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-struct ehca_module {</font></tt>
<br><tt><font size=2>- struct list_head
shca_list;</font></tt>
<br><tt><font size=2>- spinlock_t shca_lock;</font></tt>
<br><tt><font size=2>- struct timer_list
timer;</font></tt>
<br><tt><font size=2>- kmem_cache_t
*cache_pd;</font></tt>
<br><tt><font size=2>- kmem_cache_t
*cache_cq;</font></tt>
<br><tt><font size=2>- kmem_cache_t
*cache_qp;</font></tt>
<br><tt><font size=2>- kmem_cache_t
*cache_av;</font></tt>
<br><tt><font size=2>- kmem_cache_t
*cache_mr;</font></tt>
<br><tt><font size=2>- kmem_cache_t
*cache_mw;</font></tt>
<br><tt><font size=2>-};</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> struct ehca_eq {</font></tt>
<br><tt><font size=2> u32 length;</font></tt>
<br><tt><font size=2> struct ipz_queue
ipz_queue;</font></tt>
<br><tt><font size=2>@@ -274,11 +262,26 @@ int ehca_shca_delete(struct
ehca_shca *m</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> struct ehca_sport *ehca_sport_new(struct ehca_shca
*anchor);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+int ehca_init_pd_cache(void);</font></tt>
<br><tt><font size=2>+void ehca_cleanup_pd_cache(void);</font></tt>
<br><tt><font size=2>+int ehca_init_cq_cache(void);</font></tt>
<br><tt><font size=2>+void ehca_cleanup_cq_cache(void);</font></tt>
<br><tt><font size=2>+int ehca_init_qp_cache(void);</font></tt>
<br><tt><font size=2>+void ehca_cleanup_qp_cache(void);</font></tt>
<br><tt><font size=2>+int ehca_init_av_cache(void);</font></tt>
<br><tt><font size=2>+void ehca_cleanup_av_cache(void);</font></tt>
<br><tt><font size=2>+int ehca_init_mrmw_cache(void);</font></tt>
<br><tt><font size=2>+void ehca_cleanup_mrmw_cache(void);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> extern spinlock_t ehca_qp_idr_lock;</font></tt>
<br><tt><font size=2> extern spinlock_t ehca_cq_idr_lock;</font></tt>
<br><tt><font size=2> extern struct idr ehca_qp_idr;</font></tt>
<br><tt><font size=2> extern struct idr ehca_cq_idr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+extern int ehca_static_rate;</font></tt>
<br><tt><font size=2>+extern int ehca_port_act_time;</font></tt>
<br><tt><font size=2>+extern int ehca_use_hp_mr;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> struct ipzu_queue_resp {</font></tt>
<br><tt><font size=2> u64 queue;
/* points to first queue entry */</font></tt>
<br><tt><font size=2> u32 qe_size;
/* queue entry size */</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_cq.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_cq.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_cq.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_cq.c
2006-08-30 20:00:17.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -43,8 +43,6 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "e_cq"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/current.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2>@@ -52,17 +50,20 @@</font></tt>
<br><tt><font size=2> #include "ehca_irq.h"</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+static struct kmem_cache *cq_cache;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> int ehca_cq_assign_qp(struct ehca_cq *cq, struct
ehca_qp *qp)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> unsigned
int qp_num = qp->real_qp_num;</font></tt>
<br><tt><font size=2> unsigned
int key = qp_num & (QP_HASHTAB_LEN-1);</font></tt>
<br><tt><font size=2>- unsigned long
spl_flags = 0;</font></tt>
<br><tt><font size=2>+ unsigned long
spl_flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_irqsave(&cq->spinlock,
spl_flags);</font></tt>
<br><tt><font size=2> hlist_add_head(&qp->list_entries,
&cq->qp_hashtab[key]);</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&cq->spinlock,
spl_flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "cq_num=%x
real_qp_num=%x", cq->cq_number, qp_num);</font></tt>
<br><tt><font size=2>+ ehca_dbg(cq->ib_cq.device,
"cq_num=%x real_qp_num=%x",</font></tt>
<br><tt><font size=2>+
cq->cq_number, qp_num);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -71,26 +72,27 @@ int ehca_cq_unassign_qp(struct
ehca_cq *</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= -EINVAL;</font></tt>
<br><tt><font size=2> unsigned
int key = real_qp_num & (QP_HASHTAB_LEN-1);</font></tt>
<br><tt><font size=2>- struct hlist_node
*iter = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_qp
*qp = NULL;</font></tt>
<br><tt><font size=2>- unsigned long
spl_flags = 0;</font></tt>
<br><tt><font size=2>+ struct hlist_node
*iter;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*qp;</font></tt>
<br><tt><font size=2>+ unsigned long
spl_flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_irqsave(&cq->spinlock,
spl_flags);</font></tt>
<br><tt><font size=2> hlist_for_each(iter,
&cq->qp_hashtab[key]) {</font></tt>
<br><tt><font size=2>
qp = hlist_entry(iter, struct ehca_qp, list_entries);</font></tt>
<br><tt><font size=2>
if (qp->real_qp_num == real_qp_num) {</font></tt>
<br><tt><font size=2>
hlist_del(iter);</font></tt>
<br><tt><font size=2>-
EDEB(7, "removed
qp from cq .cq_num=%x real_qp_num=%x",</font></tt>
<br><tt><font size=2>-
cq->cq_number, real_qp_num);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->ib_cq.device,</font></tt>
<br><tt><font size=2>+
"removed qp from cq .cq_num=%x real_qp_num=%x",</font></tt>
<br><tt><font size=2>+
cq->cq_number, real_qp_num);</font></tt>
<br><tt><font size=2>
ret = 0;</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&cq->spinlock,
spl_flags);</font></tt>
<br><tt><font size=2>- if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "qp not found cq_num=%x real_qp_num=%x",</font></tt>
<br><tt><font size=2>+ if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(cq->ib_cq.device,</font></tt>
<br><tt><font size=2>+
"qp not
found cq_num=%x real_qp_num=%x",</font></tt>
<br><tt><font size=2>
cq->cq_number,
real_qp_num);</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -99,8 +101,8 @@ struct ehca_qp* ehca_cq_get_qp(struct
eh</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> struct ehca_qp
*ret = NULL;</font></tt>
<br><tt><font size=2> unsigned
int key = real_qp_num & (QP_HASHTAB_LEN-1);</font></tt>
<br><tt><font size=2>- struct hlist_node
*iter = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_qp
*qp = NULL;</font></tt>
<br><tt><font size=2>+ struct hlist_node
*iter;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*qp;</font></tt>
<br><tt><font size=2> hlist_for_each(iter,
&cq->qp_hashtab[key]) {</font></tt>
<br><tt><font size=2>
qp = hlist_entry(iter, struct ehca_qp, list_entries);</font></tt>
<br><tt><font size=2>
if (qp->real_qp_num == real_qp_num) {</font></tt>
<br><tt><font size=2>@@ -115,37 +117,28 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2>
struct ib_ucontext *context,</font></tt>
<br><tt><font size=2>
struct ib_udata *udata)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- struct ib_cq
*cq = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_cq
*my_cq = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>+ static const
u32 additional_cqe = 20;</font></tt>
<br><tt><font size=2>+ struct ib_cq
*cq;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*my_cq;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> struct ipz_adapter_handle
adapter_handle;</font></tt>
<br><tt><font size=2>- /* h_call's out
parameters */</font></tt>
<br><tt><font size=2>- struct ehca_alloc_cq_parms
param;</font></tt>
<br><tt><font size=2>- u32 counter =
0;</font></tt>
<br><tt><font size=2>- void *vpage =
NULL;</font></tt>
<br><tt><font size=2>- u64 rpage = 0;</font></tt>
<br><tt><font size=2>+ struct ehca_alloc_cq_parms
param; /* h_call's out parameters */</font></tt>
<br><tt><font size=2> struct h_galpa
gal;</font></tt>
<br><tt><font size=2>- u64 cqx_fec =
0;</font></tt>
<br><tt><font size=2>- u64 h_ret = 0;</font></tt>
<br><tt><font size=2>- int ipz_rc =
0;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- const u32 additional_cqe=20;</font></tt>
<br><tt><font size=2>- int i= 0;</font></tt>
<br><tt><font size=2>+ void *vpage;</font></tt>
<br><tt><font size=2>+ u32 counter;</font></tt>
<br><tt><font size=2>+ u64 rpage, cqx_fec,
h_ret;</font></tt>
<br><tt><font size=2>+ int ipz_rc, ret,
i;</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_DEVICE_P(device);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "device=%p
cqe=%x context=%p", device, cqe, context);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (cqe
>= 0xFFFFFFFF - 64 - additional_cqe)</font></tt>
<br><tt><font size=2>
return ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- my_cq = kmem_cache_alloc(ehca_module.cache_cq,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2>+ my_cq = kmem_cache_alloc(cq_cache,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2> if (!my_cq)
{</font></tt>
<br><tt><font size=2>-
cq = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Out of memory for ehca_cq struct
device=%p",</font></tt>
<br><tt><font size=2>+
ehca_err(device, "Out of memory for ehca_cq struct
device=%p",</font></tt>
<br><tt><font size=2>
device);</font></tt>
<br><tt><font size=2>-
goto create_cq_exit0;</font></tt>
<br><tt><font size=2>+
return ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> memset(my_cq,
0, sizeof(struct ehca_cq));</font></tt>
<br><tt><font size=2>@@ -158,17 +151,14 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> cq = &my_cq->ib_cq;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> adapter_handle
= shca->ipz_hca_handle;</font></tt>
<br><tt><font size=2> param.eq_handle
= shca->eq.ipz_eq_handle;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> do {</font></tt>
<br><tt><font size=2>
if (!idr_pre_get(&ehca_cq_idr, GFP_KERNEL))
{</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,</font></tt>
<br><tt><font size=2>-
"Can't reserve idr resources. "</font></tt>
<br><tt><font size=2>-
"device=%p", device);</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"Can't reserve idr nr. device=%p",</font></tt>
<br><tt><font size=2>+
device);</font></tt>
<br><tt><font size=2>
goto create_cq_exit1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -180,9 +170,8 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,</font></tt>
<br><tt><font size=2>-
"Can't allocate
new idr entry. "</font></tt>
<br><tt><font size=2>-
"device=%p",
device);</font></tt>
<br><tt><font size=2>+
ehca_err(device, "Can't allocate new idr entry.
device=%p",</font></tt>
<br><tt><font size=2>+
device);</font></tt>
<br><tt><font size=2>
goto create_cq_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -194,7 +183,7 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_alloc_resource_cq(adapter_handle, my_cq, ¶m);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"hipz_h_alloc_resource_cq() failed
"</font></tt>
<br><tt><font size=2>+
ehca_err(device, "hipz_h_alloc_resource_cq()
failed "</font></tt>
<br><tt><font size=2>
"h_ret=%lx
device=%p", h_ret, device);</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(ehca2ib_return_code(h_ret));</font></tt>
<br><tt><font size=2>
goto create_cq_exit2;</font></tt>
<br><tt><font size=2>@@ -203,9 +192,8 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> ipz_rc =
ipz_queue_ctor(&my_cq->ipz_queue, param.act_pages,</font></tt>
<br><tt><font size=2>
EHCA_PAGESIZE, sizeof(struct ehca_cqe), 0);</font></tt>
<br><tt><font size=2> if (!ipz_rc)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,</font></tt>
<br><tt><font size=2>-
"ipz_queue_ctor()
failed "</font></tt>
<br><tt><font size=2>-
"ipz_rc=%x
device=%p", ipz_rc, device);</font></tt>
<br><tt><font size=2>+
ehca_err(device, "ipz_queue_ctor() failed ipz_rc=%x
device=%p",</font></tt>
<br><tt><font size=2>+
ipz_rc, device);</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto create_cq_exit3;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -213,7 +201,7 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> for (counter
= 0; counter < param.act_pages; counter++) {</font></tt>
<br><tt><font size=2>
vpage = ipz_qpageit_get_inc(&my_cq->ipz_queue);</font></tt>
<br><tt><font size=2>
if (!vpage) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "ipz_qpageit_get_inc()
"</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>
"returns NULL device=%p", device);</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(-EAGAIN);</font></tt>
<br><tt><font size=2>
goto create_cq_exit4;</font></tt>
<br><tt><font size=2>@@ -231,10 +219,9 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2>
kernel);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (h_ret < H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_h_register_rpage_cq()
failed "</font></tt>
<br><tt><font size=2>-
"ehca_cq=%p cq_num=%x h_ret=%lx "</font></tt>
<br><tt><font size=2>-
"counter=%i act_pages=%i",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number,</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"hipz_h_register_rpage_cq() failed "</font></tt>
<br><tt><font size=2>+
"ehca_cq=%p cq_num=%x h_ret=%lx counter=%i "</font></tt>
<br><tt><font size=2>+
"act_pages=%i", my_cq, my_cq->cq_number,</font></tt>
<br><tt><font size=2>
h_ret, counter, param.act_pages);</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto create_cq_exit4;</font></tt>
<br><tt><font size=2>@@ -243,16 +230,16 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2>
if (counter == (param.act_pages - 1)) {</font></tt>
<br><tt><font size=2>
vpage =
ipz_qpageit_get_inc(&my_cq->ipz_queue);</font></tt>
<br><tt><font size=2>
if ((h_ret
!= H_SUCCESS) || vpage) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Registration of pages not "</font></tt>
<br><tt><font size=2>+
ehca_err(device, "Registration of pages not "</font></tt>
<br><tt><font size=2>
"complete
ehca_cq=%p cq_num=%x "</font></tt>
<br><tt><font size=2>-
"h_ret=%lx",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number,
h_ret);</font></tt>
<br><tt><font size=2>+
"h_ret=%lx",
my_cq, my_cq->cq_number,</font></tt>
<br><tt><font size=2>+
h_ret);</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(-EAGAIN);</font></tt>
<br><tt><font size=2>
goto create_cq_exit4;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
} else {</font></tt>
<br><tt><font size=2>
if (h_ret
!= H_PAGE_REGISTERED) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Registration of page failed "</font></tt>
<br><tt><font size=2>+
ehca_err(device, "Registration of page failed
"</font></tt>
<br><tt><font size=2>
"ehca_cq=%p
cq_num=%x h_ret=%lx"</font></tt>
<br><tt><font size=2>
"counter=%i
act_pages=%i",</font></tt>
<br><tt><font size=2>
my_cq,
my_cq->cq_number,</font></tt>
<br><tt><font size=2>@@ -267,8 +254,8 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> gal = my_cq->galpas.kernel;</font></tt>
<br><tt><font size=2> cqx_fec
= hipz_galpa_load(gal, CQTEMM_OFFSET(cqx_fec));</font></tt>
<br><tt><font size=2>- EDEB(8, "ehca_cq=%p
cq_num=%x CQX_FEC=%lx",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, cqx_fec);</font></tt>
<br><tt><font size=2>+ ehca_dbg(device,
"ehca_cq=%p cq_num=%x CQX_FEC=%lx",</font></tt>
<br><tt><font size=2>+
my_cq, my_cq->cq_number, cqx_fec);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> my_cq->ib_cq.cqe
= my_cq->nr_of_entries =</font></tt>
<br><tt><font size=2>
param.act_nr_of_entries - additional_cqe;</font></tt>
<br><tt><font size=2>@@ -280,7 +267,7 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2> if (context)
{</font></tt>
<br><tt><font size=2>
struct ipz_queue *ipz_queue = &my_cq->ipz_queue;</font></tt>
<br><tt><font size=2>
struct ehca_create_cq_resp resp;</font></tt>
<br><tt><font size=2>-
struct vm_area_struct *vma = NULL;</font></tt>
<br><tt><font size=2>+
struct vm_area_struct *vma;</font></tt>
<br><tt><font size=2>
memset(&resp, 0, sizeof(resp));</font></tt>
<br><tt><font size=2>
resp.cq_number = my_cq->cq_number;</font></tt>
<br><tt><font size=2>
resp.token = my_cq->token;</font></tt>
<br><tt><font size=2>@@ -294,7 +281,7 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2>
(void**)&resp.ipz_queue.queue,</font></tt>
<br><tt><font size=2>
&vma);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could
not mmap queue pages");</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"Could not mmap queue pages");</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(ret);</font></tt>
<br><tt><font size=2>
goto create_cq_exit4;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -304,19 +291,17 @@ struct ib_cq *ehca_create_cq(struct
ib_d</font></tt>
<br><tt><font size=2>
(void**)&resp.galpas.kernel.fw_handle,</font></tt>
<br><tt><font size=2>
&vma);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could
not mmap fw_handle");</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"Could not mmap fw_handle");</font></tt>
<br><tt><font size=2>
cq = ERR_PTR(ret);</font></tt>
<br><tt><font size=2>
goto create_cq_exit5;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
my_cq->uspace_fwh = (u64)resp.galpas.kernel.fw_handle;</font></tt>
<br><tt><font size=2>
if (ib_copy_to_udata(udata, &resp, sizeof(resp)))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Copy
to udata failed.");</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"Copy to udata failed.");</font></tt>
<br><tt><font size=2>
goto create_cq_exit6;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7,"retcode=%p
ehca_cq=%p cq_num=%x cq_size=%x",</font></tt>
<br><tt><font size=2>-
cq, my_cq, my_cq->cq_number, param.act_nr_of_entries);</font></tt>
<br><tt><font size=2> return cq;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_cq_exit6:</font></tt>
<br><tt><font size=2>@@ -331,8 +316,8 @@ create_cq_exit4:</font></tt>
<br><tt><font size=2> create_cq_exit3:</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_destroy_cq(adapter_handle, my_cq, 1);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS)</font></tt>
<br><tt><font size=2>-
EDEB(4, "hipz_h_destroy_cq() failed ehca_cq=%p
cq_num=%x "</font></tt>
<br><tt><font size=2>-
"h_ret=%lx", my_cq, my_cq->cq_number,
h_ret);</font></tt>
<br><tt><font size=2>+
ehca_err(device, "hipz_h_destroy_cq() failed
ehca_cq=%p "</font></tt>
<br><tt><font size=2>+
"cq_num=%x
h_ret=%lx", my_cq, my_cq->cq_number, h_ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_cq_exit2:</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2>@@ -340,36 +325,24 @@ create_cq_exit2:</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_cq_exit1:</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_cq,
my_cq);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(cq_cache,
my_cq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-create_cq_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(4, "An
error has occured retcode=%p", cq);</font></tt>
<br><tt><font size=2> return cq;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_destroy_cq(struct ib_cq *cq)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- u64 h_ret = 0;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_cq
*my_cq = NULL;</font></tt>
<br><tt><font size=2>- int cq_num =
0;</font></tt>
<br><tt><font size=2>- struct ib_device
*device = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ipz_adapter_handle
adapter_handle;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*my_cq = container_of(cq, struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>+ int cq_num =
my_cq->cq_number;</font></tt>
<br><tt><font size=2>+ struct ib_device
*device = cq->device;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(device, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2>+ struct ipz_adapter_handle
adapter_handle = shca->ipz_hca_handle;</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_CQ(cq);</font></tt>
<br><tt><font size=2>- my_cq = container_of(cq,
struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>- cq_num = my_cq->cq_number;</font></tt>
<br><tt><font size=2>- device = cq->device;</font></tt>
<br><tt><font size=2>- EHCA_CHECK_DEVICE(device);</font></tt>
<br><tt><font size=2>- shca = container_of(device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>- adapter_handle
= shca->ipz_hca_handle;</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_cq=%p
cq_num=%x",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2> while (my_cq->nr_callbacks)</font></tt>
<br><tt><font size=2>
yield();</font></tt>
<br><tt><font size=2>@@ -378,7 +351,7 @@ int ehca_destroy_cq(struct ib_cq
*cq)</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (my_cq->uspace_queue
&& my_cq->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(device, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_cq->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -386,64 +359,69 @@ int ehca_destroy_cq(struct ib_cq
*cq)</font></tt>
<br><tt><font size=2> /* un-mmap
if vma alloc */</font></tt>
<br><tt><font size=2> if (my_cq->uspace_queue
) {</font></tt>
<br><tt><font size=2>
ret = ehca_munmap(my_cq->uspace_queue,</font></tt>
<br><tt><font size=2>-
my_cq->ipz_queue.queue_length);</font></tt>
<br><tt><font size=2>+
my_cq->ipz_queue.queue_length);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"Could not munmap queue ehca_cq=%p "</font></tt>
<br><tt><font size=2>+
"cq_num=%x", my_cq, cq_num);</font></tt>
<br><tt><font size=2>
ret = ehca_munmap(my_cq->uspace_fwh, EHCA_PAGESIZE);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(device,
"Could not munmap fwh ehca_cq=%p "</font></tt>
<br><tt><font size=2>+
"cq_num=%x", my_cq, cq_num);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_destroy_cq(adapter_handle, my_cq, 0);</font></tt>
<br><tt><font size=2> if (h_ret
== H_R_STATE) {</font></tt>
<br><tt><font size=2>
/* cq in err: read err data and destroy it
forcibly */</font></tt>
<br><tt><font size=2>-
EDEB(4, "ehca_cq=%p cq_num=%x ressource=%lx in
err state. "</font></tt>
<br><tt><font size=2>-
"Try to delete it forcibly.",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, my_cq->ipz_cq_handle.handle);</font></tt>
<br><tt><font size=2>+
ehca_dbg(device, "ehca_cq=%p cq_num=%x ressource=%lx
in err "</font></tt>
<br><tt><font size=2>+
"state.
Try to delete it forcibly.",</font></tt>
<br><tt><font size=2>+
my_cq, cq_num,
my_cq->ipz_cq_handle.handle);</font></tt>
<br><tt><font size=2>
ehca_error_data(shca, my_cq, my_cq->ipz_cq_handle.handle);</font></tt>
<br><tt><font size=2>
h_ret = hipz_h_destroy_cq(adapter_handle, my_cq,
1);</font></tt>
<br><tt><font size=2>
if (h_ret == H_SUCCESS)</font></tt>
<br><tt><font size=2>-
EDEB(4, "ehca_cq=%p
cq_num=%x deleted successfully.",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>+
ehca_dbg(device,
"cq_num=%x deleted successfully.",</font></tt>
<br><tt><font size=2>+
cq_num);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"hipz_h_destroy_cq() failed "</font></tt>
<br><tt><font size=2>-
"h_ret=%lx
ehca_cq=%p cq_num=%x",</font></tt>
<br><tt><font size=2>-
h_ret, my_cq,
my_cq->cq_number);</font></tt>
<br><tt><font size=2>-
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>-
goto destroy_cq_exit0;</font></tt>
<br><tt><font size=2>+
ehca_err(device, "hipz_h_destroy_cq() failed
h_ret=%lx "</font></tt>
<br><tt><font size=2>+
"ehca_cq=%p
cq_num=%x", h_ret, my_cq, cq_num);</font></tt>
<br><tt><font size=2>+
return ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> ipz_queue_dtor(&my_cq->ipz_queue);</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_cq,
my_cq);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(cq_cache,
my_cq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-destroy_cq_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_cq=%p
cq_num=%x ret=%x ",</font></tt>
<br><tt><font size=2>-
my_cq, cq_num, ret);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_resize_cq(struct ib_cq *cq, int cqe,
struct ib_udata *udata)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_cq
*my_cq = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*my_cq = container_of(cq, struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (unlikely(!cq))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "cq is NULL");</font></tt>
<br><tt><font size=2>-
return -EFAULT;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_cq = container_of(cq,
struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_cq=%p
cq_num=%x",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (my_cq->uspace_queue
&& my_cq->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(cq->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_cq->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* TODO:
proper resize needs to be done */</font></tt>
<br><tt><font size=2>- ret = -EFAULT;</font></tt>
<br><tt><font size=2>- EDEB_ERR(4, "not
implemented yet");</font></tt>
<br><tt><font size=2>+ ehca_err(cq->device,
"not implemented yet");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_cq=%p
cq_num=%x",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return -EFAULT;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+int ehca_init_cq_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ cq_cache = kmem_cache_create("ehca_cache_cq",</font></tt>
<br><tt><font size=2>+
sizeof(struct ehca_cq), 0,</font></tt>
<br><tt><font size=2>+
SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>+
NULL, NULL);</font></tt>
<br><tt><font size=2>+ if (!cq_cache)</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+void ehca_cleanup_cq_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ if (cq_cache)</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(cq_cache);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_eq.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_eq.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_eq.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_eq.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -43,8 +43,6 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "e_eq"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2> #include "ehca_irq.h"</font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2>@@ -56,24 +54,21 @@ int ehca_create_eq(struct ehca_shca
*shc</font></tt>
<br><tt><font size=2>
struct ehca_eq *eq,</font></tt>
<br><tt><font size=2>
const enum ehca_eq_type type, const
u32 length)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u32 nr_pages
= 0;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2>+ u32 nr_pages;</font></tt>
<br><tt><font size=2> u32 i;</font></tt>
<br><tt><font size=2>- void *vpage =
NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
eq=%p length=%x", shca, eq, length);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(shca);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(eq);</font></tt>
<br><tt><font size=2>+ void *vpage;</font></tt>
<br><tt><font size=2>+ struct ib_device
*ib_dev = &shca->ib_device;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_init(&eq->spinlock);</font></tt>
<br><tt><font size=2> eq->is_initialized
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (type
!= EHCA_EQ && type != EHCA_NEQ) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid EQ type %x. eq=%p",
type, eq);</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "Invalid EQ type %x. eq=%p",
type, eq);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- if (length ==
0) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "EQ length must not be zero. eq=%p",
eq);</font></tt>
<br><tt><font size=2>+ if (!length)
{</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "EQ length must not be zero.
eq=%p", eq);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -86,14 +81,14 @@ int ehca_create_eq(struct ehca_shca
*shc</font></tt>
<br><tt><font size=2>
&nr_pages, &eq->ist);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate EQ / NEQ. eq=%p",
eq);</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "Can't allocate EQ/NEQ. eq=%p",
eq);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ipz_queue_ctor(&eq->ipz_queue,
nr_pages,</font></tt>
<br><tt><font size=2>
EHCA_PAGESIZE, sizeof(struct ehca_eqe), 0);</font></tt>
<br><tt><font size=2> if (!ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate EQ pages. eq=%p",
eq);</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "Can't allocate EQ pages eq=%p",
eq);</font></tt>
<br><tt><font size=2>
goto create_eq_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -130,7 +125,7 @@ int ehca_create_eq(struct ehca_shca
*shc</font></tt>
<br><tt><font size=2>
SA_INTERRUPT,
"ehca_eq",</font></tt>
<br><tt><font size=2>
(void
*)shca);</font></tt>
<br><tt><font size=2>
if (ret < 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't
map interrupt handler.");</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,
"Can't map interrupt handler.");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
tasklet_init(&eq->interrupt_task, ehca_tasklet_eq,
(long)shca);</font></tt>
<br><tt><font size=2> } else if
(type == EHCA_NEQ) {</font></tt>
<br><tt><font size=2>@@ -138,15 +133,13 @@ int ehca_create_eq(struct ehca_shca
*shc</font></tt>
<br><tt><font size=2>
SA_INTERRUPT,
"ehca_neq",</font></tt>
<br><tt><font size=2>
(void
*)shca);</font></tt>
<br><tt><font size=2>
if (ret < 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't
map interrupt handler.");</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,
"Can't map interrupt handler.");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
tasklet_init(&eq->interrupt_task, ehca_tasklet_neq,
(long)shca);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> eq->is_initialized
= 1;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_eq_exit2:</font></tt>
<br><tt><font size=2>@@ -155,53 +148,25 @@ create_eq_exit2:</font></tt>
<br><tt><font size=2> create_eq_exit1:</font></tt>
<br><tt><font size=2> hipz_h_destroy_eq(shca->ipz_hca_handle,
eq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> void *ehca_poll_eq(struct ehca_shca *shca, struct
ehca_eq *eq)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- unsigned long
flags = 0;</font></tt>
<br><tt><font size=2>- void *eqe = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
eq=%p", shca, eq);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR_P(shca);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_EQ_P(eq);</font></tt>
<br><tt><font size=2>+ unsigned long
flags;</font></tt>
<br><tt><font size=2>+ void *eqe;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_irqsave(&eq->spinlock,
flags);</font></tt>
<br><tt><font size=2> eqe = ipz_eqit_eq_get_inc_valid(&eq->ipz_queue);</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&eq->spinlock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "eq=%p
eqe=%p", eq, eqe);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return eqe;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-void ehca_poll_eqs(unsigned long data)</font></tt>
<br><tt><font size=2>-{</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2>- struct ehca_module
*module = (struct ehca_module*)data;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- spin_lock(&module->shca_lock);</font></tt>
<br><tt><font size=2>- list_for_each_entry(shca,
&module->shca_list, shca_list) {</font></tt>
<br><tt><font size=2>-
if (shca->eq.is_initialized)</font></tt>
<br><tt><font size=2>-
ehca_tasklet_eq((unsigned
long)(void*)shca);</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- mod_timer(&module->timer,
jiffies + HZ);</font></tt>
<br><tt><font size=2>- spin_unlock(&module->shca_lock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return;</font></tt>
<br><tt><font size=2>-}</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> int ehca_destroy_eq(struct ehca_shca *shca,
struct ehca_eq *eq)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- unsigned long
flags = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
eq=%p", shca, eq);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(shca);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_EQ(eq);</font></tt>
<br><tt><font size=2>+ unsigned long
flags;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_irqsave(&eq->spinlock,
flags);</font></tt>
<br><tt><font size=2> ibmebus_free_irq(NULL,
eq->ist, (void *)shca);</font></tt>
<br><tt><font size=2>@@ -211,12 +176,10 @@ int ehca_destroy_eq(struct ehca_shca
*sh</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&eq->spinlock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't free EQ resources.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't free
EQ resources.");</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> ipz_queue_dtor(&eq->ipz_queue);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "h_ret=%lx",
h_ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return h_ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_hca.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_hca.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_hca.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_hca.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -39,36 +39,29 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#undef DEB_PREFIX</font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "shca"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_query_device(struct ib_device *ibdev,
struct ib_device_attr *props)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibdev, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2> struct hipz_query_hca
*rblock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- memset(props,
0, sizeof(struct ib_device_attr));</font></tt>
<br><tt><font size=2>- shca = container_of(ibdev,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate rblock memory.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto query_device0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't allocate
rblock memory.");</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (hipz_h_query_hca(shca->ipz_hca_handle,
rblock) != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't query device properties");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't query
device properties");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto query_device1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ memset(props,
0, sizeof(struct ib_device_attr));</font></tt>
<br><tt><font size=2> props->fw_ver
= rblock->hw_ver;</font></tt>
<br><tt><font size=2> props->max_mr_size
= rblock->max_mr_size;</font></tt>
<br><tt><font size=2> props->vendor_id
= rblock->vendor_id >> 8;</font></tt>
<br><tt><font size=2>@@ -105,9 +98,6 @@ int ehca_query_device(struct ib_device
*</font></tt>
<br><tt><font size=2> query_device1:</font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-query_device0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -115,27 +105,23 @@ int ehca_query_port(struct ib_device
*ib</font></tt>
<br><tt><font size=2>
u8 port, struct ib_port_attr
*props)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibdev, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2> struct hipz_query_port
*rblock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x",
port);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- memset(props,
0, sizeof(struct ib_port_attr));</font></tt>
<br><tt><font size=2>- shca = container_of(ibdev,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate rblock memory.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto query_port0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't allocate
rblock memory.");</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (hipz_h_query_port(shca->ipz_hca_handle,
port, rblock) != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't query port properties");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't query
port properties");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto query_port1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+ memset(props,
0, sizeof(struct ib_port_attr));</font></tt>
<br><tt><font size=2> props->state
= rblock->state;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> switch (rblock->max_mtu)
{</font></tt>
<br><tt><font size=2>@@ -155,7 +141,9 @@ int ehca_query_port(struct ib_device
*ib</font></tt>
<br><tt><font size=2>
props->active_mtu = props->max_mtu =
IB_MTU_4096;</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Unknown MTU size: %x.", rblock->max_mtu);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Unknown MTU
size: %x.",</font></tt>
<br><tt><font size=2>+
rblock->max_mtu);</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> props->gid_tbl_len
= rblock->gid_tbl_len;</font></tt>
<br><tt><font size=2>@@ -176,37 +164,28 @@ int ehca_query_port(struct ib_device
*ib</font></tt>
<br><tt><font size=2> query_port1:</font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-query_port0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_query_pkey(struct ib_device *ibdev,
u8 port, u16 index, u16 *pkey)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibdev, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> struct hipz_query_port
*rblock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x
index=%x", port, index);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (index
> 16) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid index: %x.", index);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto query_pkey0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Invalid index:
%x.", index);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(ibdev,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate rblock memory.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto query_pkey0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't
allocate rblock memory.");</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (hipz_h_query_port(shca->ipz_hca_handle,
port, rblock) != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't query port properties");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't query
port properties");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto query_pkey1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -216,9 +195,6 @@ int ehca_query_pkey(struct ib_device
*ib</font></tt>
<br><tt><font size=2> query_pkey1:</font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-query_pkey0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -226,28 +202,23 @@ int ehca_query_gid(struct ib_device
*ibd</font></tt>
<br><tt><font size=2>
int index, union ib_gid *gid)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibdev, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2> struct hipz_query_port
*rblock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x
index=%x", port, index);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (index
> 255) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid index: %x.", index);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto query_gid0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Invalid index:
%x.", index);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(ibdev,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate rblock memory.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto query_gid0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't allocate
rblock memory.");</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (hipz_h_query_port(shca->ipz_hca_handle,
port, rblock) != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't query port properties");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't query
port properties");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto query_gid1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -258,11 +229,6 @@ int ehca_query_gid(struct ib_device
*ibd</font></tt>
<br><tt><font size=2> query_gid1:</font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-query_gid0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
GID=%lx%lx", ret,</font></tt>
<br><tt><font size=2>-
*(u64 *) & gid->raw[0],</font></tt>
<br><tt><font size=2>-
*(u64 *) & gid->raw[8]);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -270,13 +236,6 @@ int ehca_modify_port(struct ib_device
*i</font></tt>
<br><tt><font size=2>
u8 port, int port_modify_mask,</font></tt>
<br><tt><font size=2>
struct ib_port_modify *props)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x",
port);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- /* Not implemented
yet. */</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ /* Not implemented
yet */</font></tt>
<br><tt><font size=2>+ return -EFAULT;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_irq.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_irq.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -39,8 +39,6 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "eirq"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2> #include "ehca_irq.h"</font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2>@@ -64,15 +62,17 @@</font></tt>
<br><tt><font size=2> #define ERROR_DATA_LENGTH EHCA_BMASK_IBM(52,63)</font></tt>
<br><tt><font size=2> #define ERROR_DATA_TYPE
EHCA_BMASK_IBM(0,7)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+#ifdef CONFIG_INFINIBAND_EHCA_SCALING</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> static void queue_comp_task(struct ehca_cq *__cq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static struct ehca_comp_pool* pool;</font></tt>
<br><tt><font size=2> static struct notifier_block comp_pool_callback_nb;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+#endif</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> static inline void comp_event_callback(struct
ehca_cq *cq)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cq=%p",
cq);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (!cq->ib_cq.comp_handler)</font></tt>
<br><tt><font size=2>
return;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -80,8 +80,6 @@ static inline void comp_event_callback(s</font></tt>
<br><tt><font size=2> cq->ib_cq.comp_handler(&cq->ib_cq,
cq->ib_cq.cq_context);</font></tt>
<br><tt><font size=2> spin_unlock(&cq->cb_lock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq=%p",
cq);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -91,9 +89,6 @@ static void print_error_data(struct
ehca</font></tt>
<br><tt><font size=2> u64 type
= EHCA_BMASK_GET(ERROR_DATA_TYPE, rblock[2]);</font></tt>
<br><tt><font size=2> u64 resource
= rblock[1];</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
data=%p rblock=%p length=%x",</font></tt>
<br><tt><font size=2>-
shca, data, rblock, length);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> switch (type)
{</font></tt>
<br><tt><font size=2> case 0x1:
/* Queue Pair */</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>@@ -103,7 +98,8 @@ static void print_error_data(struct
ehca</font></tt>
<br><tt><font size=2>
if (rblock[6] == 0)</font></tt>
<br><tt><font size=2>
return;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "QP 0x%x (resource=%lx) has errors.",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"QP 0x%x
(resource=%lx) has errors.",</font></tt>
<br><tt><font size=2>
qp->ib_qp.qp_num,
resource);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -111,25 +107,25 @@ static void print_error_data(struct
ehca</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>
struct ehca_cq *cq = (struct ehca_cq*)data;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "CQ 0x%x (resource=%lx) has errors.",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"CQ 0x%x
(resource=%lx) has errors.",</font></tt>
<br><tt><font size=2>
cq->cq_number,
resource);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Unknown errror type: %lx on %s.",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Unknown
errror type: %lx on %s.",</font></tt>
<br><tt><font size=2>
type,
shca->ib_device.name);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_ERR(4, "Error
data is available: %lx.", resource);</font></tt>
<br><tt><font size=2>- EDEB_ERR(4, "EHCA
----- error data begin "</font></tt>
<br><tt><font size=2>+ ehca_err(&shca->ib_device,
"Error data is available: %lx.", resource);</font></tt>
<br><tt><font size=2>+ ehca_err(&shca->ib_device,
"EHCA ----- error data begin "</font></tt>
<br><tt><font size=2>
"---------------------------------------------------");</font></tt>
<br><tt><font size=2>- EDEB_DMP(4, rblock,
length, "resource=%lx", resource);</font></tt>
<br><tt><font size=2>- EDEB_ERR(4, "EHCA
----- error data end "</font></tt>
<br><tt><font size=2>+ ehca_dmp(rblock,
length, "resource=%lx", resource);</font></tt>
<br><tt><font size=2>+ ehca_err(&shca->ib_device,
"EHCA ----- error data end "</font></tt>
<br><tt><font size=2>
"----------------------------------------------------");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -137,15 +133,13 @@ int ehca_error_data(struct ehca_shca
*sh</font></tt>
<br><tt><font size=2>
u64 resource)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- unsigned long
ret = 0;</font></tt>
<br><tt><font size=2>+ unsigned long
ret;</font></tt>
<br><tt><font size=2> u64 *rblock;</font></tt>
<br><tt><font size=2> unsigned
long block_count;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
data=%p resource=%lx", shca, data, resource);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot allocate rblock memory.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot allocate
rblock memory.");</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>
goto error_data1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -156,7 +150,8 @@ int ehca_error_data(struct ehca_shca
*sh</font></tt>
<br><tt><font size=2>
&block_count);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_R_STATE) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "No error data is available: %lx.",
resource);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"No error
data is available: %lx.", resource);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> else if
(ret == H_SUCCESS) {</font></tt>
<br><tt><font size=2>
int length;</font></tt>
<br><tt><font size=2>@@ -169,7 +164,8 @@ int ehca_error_data(struct ehca_shca
*sh</font></tt>
<br><tt><font size=2>
print_error_data(shca, data, rblock, length);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Error data could not be fetched:
%lx", resource);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Error data
could not be fetched: %lx", resource);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2>@@ -188,8 +184,6 @@ static void qp_event_callback(struct
ehc</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2> u32 token
= EHCA_BMASK_GET(EQE_QP_TOKEN, eqe);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "eqe=%lx",
eqe);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&ehca_qp_idr_lock,
flags);</font></tt>
<br><tt><font size=2> qp = idr_find(&ehca_qp_idr,
token);</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&ehca_qp_idr_lock,
flags);</font></tt>
<br><tt><font size=2>@@ -209,8 +203,6 @@ static void qp_event_callback(struct
ehc</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> qp->ib_qp.event_handler(&event,
qp->ib_qp.qp_context);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "qp=%p",
qp);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -221,8 +213,6 @@ static void cq_event_callback(struct
ehc</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2> u32 token
= EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "eqe=%lx",
eqe);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2> cq = idr_find(&ehca_cq_idr,
token);</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2>@@ -232,8 +222,6 @@ static void cq_event_callback(struct
ehc</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_error_data(shca,
cq, cq->ipz_cq_handle.handle);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq=%p",
cq);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -241,8 +229,6 @@ static void parse_identifier(struct
ehca</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> u8 identifier
= EHCA_BMASK_GET(EQE_EE_IDENTIFIER, eqe);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
eqe=%lx", shca, eqe);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> switch (identifier)
{</font></tt>
<br><tt><font size=2> case 0x02:
/* path migrated */</font></tt>
<br><tt><font size=2>
qp_event_callback(shca, eqe, IB_EVENT_PATH_MIG);</font></tt>
<br><tt><font size=2>@@ -262,41 +248,39 @@ static void parse_identifier(struct
ehca</font></tt>
<br><tt><font size=2>
cq_event_callback(shca, eqe);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x09:
/* MRMWPTE error */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "MRMWPTE error.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "MRMWPTE error.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x0A:
/* port event */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Port event.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Port event.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x0B:
/* MR access error */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "MR access error.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "MR access
error.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x0C:
/* EQ error */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "EQ error.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "EQ error.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x0D:
/* P/Q_Key mismatch */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "P/Q_Key mismatch.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "P/Q_Key mismatch.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x10:
/* sampling complete */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Sampling complete.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Sampling complete.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x11:
/* unaffiliated access error */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Unaffiliated access error.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Unaffiliated
access error.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x12:
/* path migrating error */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Path migration error.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Path migration
error.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x13:
/* interface trace stopped */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Interface trace stopped.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Interface
trace stopped.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x14:
/* first error capture info available */</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Unknown identifier: %x on %s.",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Unknown identifier:
%x on %s.",</font></tt>
<br><tt><font size=2>
identifier,
shca->ib_device.name);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "eqe=%lx
identifier=%x", eqe, identifier);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -306,21 +290,19 @@ static void parse_ec(struct
ehca_shca *s</font></tt>
<br><tt><font size=2> u8 ec
= EHCA_BMASK_GET(NEQE_EVENT_CODE, eqe);</font></tt>
<br><tt><font size=2> u8 port
= EHCA_BMASK_GET(NEQE_PORT_NUMBER, eqe);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
eqe=%lx", shca, eqe);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> switch (ec)
{</font></tt>
<br><tt><font size=2> case 0x30:
/* port availability change */</font></tt>
<br><tt><font size=2>
if (EHCA_BMASK_GET(NEQE_PORT_AVAILABILITY,
eqe)) {</font></tt>
<br><tt><font size=2>-
EDEB(4, "%s:
port %x is active.",</font></tt>
<br><tt><font size=2>-
shca->ib_device.name, port);</font></tt>
<br><tt><font size=2>+
ehca_info(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"port %x is active.", port);</font></tt>
<br><tt><font size=2>
event.device
= &shca->ib_device;</font></tt>
<br><tt><font size=2>
event.event
= IB_EVENT_PORT_ACTIVE;</font></tt>
<br><tt><font size=2>
event.element.port_num
= port;</font></tt>
<br><tt><font size=2>
shca->sport[port
- 1].port_state = IB_PORT_ACTIVE;</font></tt>
<br><tt><font size=2>
ib_dispatch_event(&event);</font></tt>
<br><tt><font size=2>
} else {</font></tt>
<br><tt><font size=2>-
EDEB(4, "%s:
port %x is inactive.",</font></tt>
<br><tt><font size=2>-
shca->ib_device.name, port);</font></tt>
<br><tt><font size=2>+
ehca_info(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"port %x is inactive.", port);</font></tt>
<br><tt><font size=2>
event.device
= &shca->ib_device;</font></tt>
<br><tt><font size=2>
event.event
= IB_EVENT_PORT_ERR;</font></tt>
<br><tt><font size=2>
event.element.port_num
= port;</font></tt>
<br><tt><font size=2>@@ -333,19 +315,19 @@ static void parse_ec(struct
ehca_shca *s</font></tt>
<br><tt><font size=2>
* disruptive change is caused by</font></tt>
<br><tt><font size=2>
* LID, PKEY or SM change</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB(4, "EHCA disruptive port %x "</font></tt>
<br><tt><font size=2>-
"configuration change.",
port);</font></tt>
<br><tt><font size=2>+
ehca_warn(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"disruptive
port %x configuration change", port);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(4, "%s: port %x is inactive.",</font></tt>
<br><tt><font size=2>-
shca->ib_device.name, port);</font></tt>
<br><tt><font size=2>+
ehca_info(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"port %x
is inactive.", port);</font></tt>
<br><tt><font size=2>
event.device = &shca->ib_device;</font></tt>
<br><tt><font size=2>
event.event = IB_EVENT_PORT_ERR;</font></tt>
<br><tt><font size=2>
event.element.port_num = port;</font></tt>
<br><tt><font size=2>
shca->sport[port - 1].port_state = IB_PORT_DOWN;</font></tt>
<br><tt><font size=2>
ib_dispatch_event(&event);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(4, "%s: port %x is active.",</font></tt>
<br><tt><font size=2>-
shca->ib_device.name, port);</font></tt>
<br><tt><font size=2>+
ehca_info(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"port %x
is active.", port);</font></tt>
<br><tt><font size=2>
event.device = &shca->ib_device;</font></tt>
<br><tt><font size=2>
event.event = IB_EVENT_PORT_ACTIVE;</font></tt>
<br><tt><font size=2>
event.element.port_num = port;</font></tt>
<br><tt><font size=2>@@ -353,34 +335,27 @@ static void parse_ec(struct
ehca_shca *s</font></tt>
<br><tt><font size=2>
ib_dispatch_event(&event);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x32:
/* adapter malfunction */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Adapter malfunction.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Adapter malfunction.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case 0x33:
/* trace stopped */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Traced stopped.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Traced stopped.");</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Unknown event code: %x on %s.",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Unknown event
code: %x on %s.",</font></tt>
<br><tt><font size=2>
ec, shca->ib_device.name);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "eqe=%lx
ec=%x", eqe, ec);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void reset_eq_pending(struct ehca_cq
*cq)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 CQx_EP =
0;</font></tt>
<br><tt><font size=2>+ u64 CQx_EP;</font></tt>
<br><tt><font size=2> struct h_galpa
gal = cq->galpas.kernel;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cq=%p",
cq);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> hipz_galpa_store_cq(gal,
cqx_ep, 0x0);</font></tt>
<br><tt><font size=2> CQx_EP =
hipz_galpa_load(gal, CQTEMM_OFFSET(cqx_ep));</font></tt>
<br><tt><font size=2>- EDEB(7, "CQx_EP=%lx",
CQx_EP);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq=%p",
cq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -389,12 +364,8 @@ irqreturn_t ehca_interrupt_neq(int
irq, </font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> struct ehca_shca
*shca = (struct ehca_shca*)dev_id;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "dev_id=%p",
dev_id);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> tasklet_hi_schedule(&shca->neq.interrupt_task);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return IRQ_HANDLED;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -402,9 +373,7 @@ void ehca_tasklet_neq(unsigned
long data</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> struct ehca_shca
*shca = (struct ehca_shca*)data;</font></tt>
<br><tt><font size=2> struct ehca_eqe
*eqe;</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> eqe = (struct
ehca_eqe *)ehca_poll_eq(shca, &shca->neq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -419,9 +388,7 @@ void ehca_tasklet_neq(unsigned
long data</font></tt>
<br><tt><font size=2>
shca->neq.ipz_eq_handle, 0xFFFFFFFFFFFFFFFFL);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
!= H_SUCCESS)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't clear notification events.");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't clear
notification events.");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -430,12 +397,8 @@ irqreturn_t ehca_interrupt_eq(int
irq, v</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> struct ehca_shca
*shca = (struct ehca_shca*)dev_id;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "dev_id=%p",
dev_id);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> tasklet_hi_schedule(&shca->eq.interrupt_task);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return IRQ_HANDLED;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -446,8 +409,6 @@ void ehca_tasklet_eq(unsigned
long data)</font></tt>
<br><tt><font size=2> int int_state;</font></tt>
<br><tt><font size=2> int query_cnt
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> do {</font></tt>
<br><tt><font size=2>
eqe = (struct ehca_eqe *)ehca_poll_eq(shca,
&shca->eq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -460,17 +421,18 @@ void ehca_tasklet_eq(unsigned
long data)</font></tt>
<br><tt><font size=2>
while (eqe)
{</font></tt>
<br><tt><font size=2>
u64 eqe_value = eqe->entry;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(7, "eqe_value=%lx", eqe_value);</font></tt>
<br><tt><font size=2>+
ehca_dbg(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"eqe_value=%lx",
eqe_value);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
/* TODO: better structure */</font></tt>
<br><tt><font size=2>
if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT,</font></tt>
<br><tt><font size=2>
eqe_value)) {</font></tt>
<br><tt><font size=2>-
extern struct
idr ehca_cq_idr;</font></tt>
<br><tt><font size=2>
unsigned
long flags;</font></tt>
<br><tt><font size=2>
u32 token;</font></tt>
<br><tt><font size=2>
struct
ehca_cq *cq;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(6, "...
completion event");</font></tt>
<br><tt><font size=2>+
ehca_dbg(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"... completion event");</font></tt>
<br><tt><font size=2>
token =</font></tt>
<br><tt><font size=2>
EHCA_BMASK_GET(EQE_CQ_TOKEN,</font></tt>
<br><tt><font size=2>
eqe_value);</font></tt>
<br><tt><font size=2>@@ -494,7 +456,8 @@ void ehca_tasklet_eq(unsigned
long data)</font></tt>
<br><tt><font size=2>
comp_event_callback(cq);</font></tt>
<br><tt><font size=2> #endif</font></tt>
<br><tt><font size=2>
} else {</font></tt>
<br><tt><font size=2>-
EDEB(6, "...
non completion event");</font></tt>
<br><tt><font size=2>+
ehca_dbg(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"... non completion event");</font></tt>
<br><tt><font size=2>
parse_identifier(shca,
eqe_value);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
eqe =</font></tt>
<br><tt><font size=2>@@ -518,29 +481,25 @@ void ehca_tasklet_eq(unsigned
long data)</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> } while
(int_state != 0);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+#ifdef CONFIG_INFINIBAND_EHCA_SCALING</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> static inline int find_next_online_cpu(struct
ehca_comp_pool* pool)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> unsigned
long flags_last_cpu;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_DMP(7, &cpu_online_map,
sizeof(cpumask_t), "");</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(&cpu_online_map, sizeof(cpumask_t), "");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_irqsave(&pool->last_cpu_lock,
flags_last_cpu);</font></tt>
<br><tt><font size=2> pool->last_cpu
= next_cpu(pool->last_cpu, cpu_online_map);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (pool->last_cpu
== NR_CPUS)</font></tt>
<br><tt><font size=2>-
pool->last_cpu = 0;</font></tt>
<br><tt><font size=2>- if (!cpu_online(pool->last_cpu))</font></tt>
<br><tt><font size=2>-
pool->last_cpu = next_cpu(pool->last_cpu, cpu_online_map);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+
pool->last_cpu = first_cpu(cpu_online_map);</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&pool->last_cpu_lock,
flags_last_cpu);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- // return pool->last_cpu;</font></tt>
<br><tt><font size=2>- return 1;</font></tt>
<br><tt><font size=2>+ return pool->last_cpu;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static void __queue_comp_task(struct ehca_cq
*__cq,</font></tt>
<br><tt><font size=2>@@ -549,8 +508,6 @@ static void __queue_comp_task(struct
ehc</font></tt>
<br><tt><font size=2> unsigned
long flags_cct;</font></tt>
<br><tt><font size=2> unsigned
long flags_cq;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "__cq=%p
cct=%p", __cq, cct);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&__cq->task_lock,
flags_cq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -565,10 +522,6 @@ static void __queue_comp_task(struct
ehc</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&__cq->task_lock,
flags_cq);</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static void queue_comp_task(struct ehca_cq *__cq)</font></tt>
<br><tt><font size=2>@@ -580,10 +533,6 @@ static void queue_comp_task(struct
ehca_</font></tt>
<br><tt><font size=2> cpu = get_cpu();</font></tt>
<br><tt><font size=2> cpu_id =
find_next_online_cpu(pool);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pool=%p
cq=%p cq_nr=%x CPU=%x:%x:%x:%x",</font></tt>
<br><tt><font size=2>-
pool, __cq, __cq->cq_number,</font></tt>
<br><tt><font size=2>-
cpu, cpu_id, num_online_cpus(), num_possible_cpus());</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> BUG_ON(!cpu_online(cpu_id));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> cct = per_cpu_ptr(pool->cpu_comp_tasks,
cpu_id);</font></tt>
<br><tt><font size=2>@@ -597,20 +546,15 @@ static void queue_comp_task(struct
ehca_</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> put_cpu();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cct=%p",
cct);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static void run_comp_task(struct ehca_cpu_comp_task*
cct)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_cq
*cq = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*cq;</font></tt>
<br><tt><font size=2> unsigned
long flags_cct;</font></tt>
<br><tt><font size=2> unsigned
long flags_cq;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cct=%p",
cct);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> while (!list_empty(&cct->cq_list))
{</font></tt>
<br><tt><font size=2>@@ -631,8 +575,6 @@ static void run_comp_task(struct
ehca_cp</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cct=%p
cq=%p", cct, cq);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -641,8 +583,6 @@ static int comp_task(void *__cct)</font></tt>
<br><tt><font size=2> struct ehca_cpu_comp_task*
cct = __cct;</font></tt>
<br><tt><font size=2> DECLARE_WAITQUEUE(wait,
current);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cct=%p",
cct);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> set_current_state(TASK_INTERRUPTIBLE);</font></tt>
<br><tt><font size=2> while(!kthread_should_stop())
{</font></tt>
<br><tt><font size=2>
add_wait_queue(&cct->wait_queue, &wait);</font></tt>
<br><tt><font size=2>@@ -661,8 +601,6 @@ static int comp_task(void *__cct)</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> __set_current_state(TASK_RUNNING);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -671,16 +609,12 @@ static struct task_struct *create_comp_t</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> struct ehca_cpu_comp_task
*cct;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cpu=%d:%d",
cpu, NR_CPUS);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> cct = per_cpu_ptr(pool->cpu_comp_tasks,
cpu);</font></tt>
<br><tt><font size=2> spin_lock_init(&cct->task_lock);</font></tt>
<br><tt><font size=2> INIT_LIST_HEAD(&cct->cq_list);</font></tt>
<br><tt><font size=2> init_waitqueue_head(&cct->wait_queue);</font></tt>
<br><tt><font size=2> cct->task
= kthread_create(comp_task, cct, "ehca_comp/%d", cpu);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cct/%d=%p",
cpu, cct);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return cct->task;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -691,8 +625,6 @@ static void destroy_comp_task(struct
ehc</font></tt>
<br><tt><font size=2> struct task_struct
*task;</font></tt>
<br><tt><font size=2> unsigned
long flags_cct;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pool=%p
cpu=%d:%d", pool, cpu, NR_CPUS);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> cct = per_cpu_ptr(pool->cpu_comp_tasks,
cpu);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_lock_irqsave(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2>@@ -706,8 +638,6 @@ static void destroy_comp_task(struct
ehc</font></tt>
<br><tt><font size=2> if (task)</font></tt>
<br><tt><font size=2>
kthread_stop(task);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -719,8 +649,6 @@ static void take_over_work(struct
ehca_c</font></tt>
<br><tt><font size=2> struct ehca_cq
*cq;</font></tt>
<br><tt><font size=2> unsigned
long flags_cct;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cpu=%x",
cpu);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> list_splice_init(&cct->cq_list,
&list);</font></tt>
<br><tt><font size=2>@@ -735,8 +663,6 @@ static void take_over_work(struct
ehca_c</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&cct->task_lock,
flags_cct);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static int comp_pool_callback(struct notifier_block
*nfb,</font></tt>
<br><tt><font size=2>@@ -746,55 +672,50 @@ static int comp_pool_callback(struct
not</font></tt>
<br><tt><font size=2> unsigned
int cpu = (unsigned long)hcpu;</font></tt>
<br><tt><font size=2> struct ehca_cpu_comp_task
*cct;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "CPU
number changed (action=%lx)", action);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> switch (action)
{</font></tt>
<br><tt><font size=2> case CPU_UP_PREPARE:</font></tt>
<br><tt><font size=2>-
EDEB(4, "CPU: %x (CPU_PREPARE)", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("CPU: %x (CPU_PREPARE)", cpu);</font></tt>
<br><tt><font size=2>
if(!create_comp_task(pool, cpu)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't
create comp_task for cpu: %x", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Can't
create comp_task for cpu: %x", cpu);</font></tt>
<br><tt><font size=2>
return
NOTIFY_BAD;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case CPU_UP_CANCELED:</font></tt>
<br><tt><font size=2>-
EDEB(4, "CPU: %x (CPU_CANCELED)", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("CPU: %x (CPU_CANCELED)", cpu);</font></tt>
<br><tt><font size=2>
cct = per_cpu_ptr(pool->cpu_comp_tasks,
cpu);</font></tt>
<br><tt><font size=2>
kthread_bind(cct->task, any_online_cpu(cpu_online_map));</font></tt>
<br><tt><font size=2>
destroy_comp_task(pool, cpu);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case CPU_ONLINE:</font></tt>
<br><tt><font size=2>-
EDEB(4, "CPU: %x (CPU_ONLINE)", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("CPU: %x (CPU_ONLINE)", cpu);</font></tt>
<br><tt><font size=2>
cct = per_cpu_ptr(pool->cpu_comp_tasks,
cpu);</font></tt>
<br><tt><font size=2>
kthread_bind(cct->task, cpu);</font></tt>
<br><tt><font size=2>
wake_up_process(cct->task);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case CPU_DOWN_PREPARE:</font></tt>
<br><tt><font size=2>-
EDEB(4, "CPU: %x (CPU_DOWN_PREPARE)", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("CPU: %x (CPU_DOWN_PREPARE)",
cpu);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case CPU_DOWN_FAILED:</font></tt>
<br><tt><font size=2>-
EDEB(4, "CPU: %x (CPU_DOWN_FAILED)", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("CPU: %x (CPU_DOWN_FAILED)",
cpu);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case CPU_DEAD:</font></tt>
<br><tt><font size=2>-
EDEB(4, "CPU: %x (CPU_DEAD)", cpu);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("CPU: %x (CPU_DEAD)", cpu);</font></tt>
<br><tt><font size=2>
destroy_comp_task(pool, cpu);</font></tt>
<br><tt><font size=2>
take_over_work(pool, cpu);</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "CPU
number changed");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return NOTIFY_OK;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+#endif</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> int ehca_create_comp_pool(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> #ifdef CONFIG_INFINIBAND_EHCA_SCALING</font></tt>
<br><tt><font size=2> int cpu;</font></tt>
<br><tt><font size=2> struct task_struct
*task;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> pool = kzalloc(sizeof(struct
ehca_comp_pool), GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (pool
== NULL)</font></tt>
<br><tt><font size=2>
return -ENOMEM;</font></tt>
<br><tt><font size=2>@@ -819,8 +740,6 @@ int ehca_create_comp_pool(void)</font></tt>
<br><tt><font size=2> comp_pool_callback_nb.notifier_call
= comp_pool_callback;</font></tt>
<br><tt><font size=2> comp_pool_callback_nb.priority
=0;</font></tt>
<br><tt><font size=2> register_cpu_notifier(&comp_pool_callback_nb);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "pool=%p",
pool);</font></tt>
<br><tt><font size=2> #endif</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2>@@ -831,16 +750,12 @@ void ehca_destroy_comp_pool(void)</font></tt>
<br><tt><font size=2> #ifdef CONFIG_INFINIBAND_EHCA_SCALING</font></tt>
<br><tt><font size=2> int i;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pool=%p",
pool);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> unregister_cpu_notifier(&comp_pool_callback_nb);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> for (i =
0; i < NR_CPUS; i++) {</font></tt>
<br><tt><font size=2>
if (cpu_online(i))</font></tt>
<br><tt><font size=2>
destroy_comp_task(pool,
i);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2> #endif</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return;</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_main.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_main.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_main.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_main.c
2006-08-30 20:00:17.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -4,6 +4,7 @@</font></tt>
<br><tt><font size=2> * module start stop, hca detection</font></tt>
<br><tt><font size=2> *</font></tt>
<br><tt><font size=2> * Authors: Heiko J Schick <schickhj@de.ibm.com></font></tt>
<br><tt><font size=2>+ * Hoang-Nam Nguyen
<hnguyen@de.ibm.com></font></tt>
<br><tt><font size=2> *</font></tt>
<br><tt><font size=2> * Copyright (c) 2005 IBM Corporation</font></tt>
<br><tt><font size=2> *</font></tt>
<br><tt><font size=2>@@ -38,8 +39,6 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "shca"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2> #include "ehca_mrmw.h"</font></tt>
<br><tt><font size=2>@@ -49,10 +48,10 @@</font></tt>
<br><tt><font size=2> MODULE_LICENSE("Dual BSD/GPL");</font></tt>
<br><tt><font size=2> MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");</font></tt>
<br><tt><font size=2> MODULE_DESCRIPTION("IBM eServer HCA InfiniBand
Device Driver");</font></tt>
<br><tt><font size=2>-MODULE_VERSION("SVNEHCA_0012");</font></tt>
<br><tt><font size=2>+MODULE_VERSION("SVNEHCA_0015");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_open_aqp1 = 0;</font></tt>
<br><tt><font size=2>-int ehca_debug_level = -1;</font></tt>
<br><tt><font size=2>+int ehca_debug_level = 0;</font></tt>
<br><tt><font size=2> int ehca_hw_level = 0;</font></tt>
<br><tt><font size=2> int ehca_nr_ports = 2;</font></tt>
<br><tt><font size=2> int ehca_use_hp_mr = 0;</font></tt>
<br><tt><font size=2>@@ -73,7 +72,7 @@ MODULE_PARM_DESC(open_aqp1,</font></tt>
<br><tt><font size=2>
"AQP1 on startup (0: no (default), 1:
yes)");</font></tt>
<br><tt><font size=2> MODULE_PARM_DESC(debug_level,</font></tt>
<br><tt><font size=2>
"debug level"</font></tt>
<br><tt><font size=2>-
" (0: node, 6: only errors (default), 9: all)");</font></tt>
<br><tt><font size=2>+
" (0: no debug traces (default), 1: with debug
traces)");</font></tt>
<br><tt><font size=2> MODULE_PARM_DESC(hw_level,</font></tt>
<br><tt><font size=2>
"hardware level"</font></tt>
<br><tt><font size=2>
" (0: autosensing (default), 1: v. 0.20,
2: v. 0.21)");</font></tt>
<br><tt><font size=2>@@ -89,170 +88,74 @@ MODULE_PARM_DESC(poll_all_eqs,</font></tt>
<br><tt><font size=2> MODULE_PARM_DESC(static_rate,</font></tt>
<br><tt><font size=2>
"set permanent static rate (default:
disabled)");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-/*</font></tt>
<br><tt><font size=2>- * This external trace mask controls what will end
up in the</font></tt>
<br><tt><font size=2>- * kernel ring buffer. Number 6 means, that everything
between</font></tt>
<br><tt><font size=2>- * 0 and 5 will be stored.</font></tt>
<br><tt><font size=2>- */</font></tt>
<br><tt><font size=2>-u8 ehca_edeb_mask[EHCA_EDEB_TRACE_MASK_SIZE]={6,
6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 6, 6,</font></tt>
<br><tt><font size=2>-
6, 6, 0, 0};</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> spinlock_t ehca_qp_idr_lock;</font></tt>
<br><tt><font size=2> spinlock_t ehca_cq_idr_lock;</font></tt>
<br><tt><font size=2> DEFINE_IDR(ehca_qp_idr);</font></tt>
<br><tt><font size=2> DEFINE_IDR(ehca_cq_idr);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-struct ehca_module ehca_module;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-void ehca_init_trace(void)</font></tt>
<br><tt><font size=2>-{</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>+static struct list_head shca_list; /* list of all
registered ehcas */</font></tt>
<br><tt><font size=2>+static spinlock_t shca_list_lock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (ehca_debug_level
!= -1) {</font></tt>
<br><tt><font size=2>-
int i;</font></tt>
<br><tt><font size=2>-
for (i = 0; i < EHCA_EDEB_TRACE_MASK_SIZE; i++)</font></tt>
<br><tt><font size=2>-
ehca_edeb_mask[i]
= ehca_debug_level;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-}</font></tt>
<br><tt><font size=2>+static struct timer_list poll_eqs_timer;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-int ehca_create_slab_caches(struct ehca_module *ehca_module)</font></tt>
<br><tt><font size=2>+static int ehca_create_slab_caches(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ehca_module->cache_pd
=</font></tt>
<br><tt><font size=2>-
kmem_cache_create("ehca_cache_pd",</font></tt>
<br><tt><font size=2>-
sizeof(struct ehca_pd),</font></tt>
<br><tt><font size=2>-
0, SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>-
NULL, NULL);</font></tt>
<br><tt><font size=2>- if (!ehca_module->cache_pd)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create PD SLAB cache.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto create_slab_caches1;</font></tt>
<br><tt><font size=2>+ ret = ehca_init_pd_cache();</font></tt>
<br><tt><font size=2>+ if (ret) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create PD SLAB cache.");</font></tt>
<br><tt><font size=2>+
return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ehca_module->cache_cq
=</font></tt>
<br><tt><font size=2>-
kmem_cache_create("ehca_cache_cq",</font></tt>
<br><tt><font size=2>-
sizeof(struct ehca_cq),</font></tt>
<br><tt><font size=2>-
0, SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>-
NULL, NULL);</font></tt>
<br><tt><font size=2>- if (!ehca_module->cache_cq)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create CQ SLAB cache.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+ ret = ehca_init_cq_cache();</font></tt>
<br><tt><font size=2>+ if (ret) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create CQ SLAB cache.");</font></tt>
<br><tt><font size=2>
goto create_slab_caches2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ehca_module->cache_qp
=</font></tt>
<br><tt><font size=2>-
kmem_cache_create("ehca_cache_qp",</font></tt>
<br><tt><font size=2>-
sizeof(struct ehca_qp),</font></tt>
<br><tt><font size=2>-
0, SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>-
NULL, NULL);</font></tt>
<br><tt><font size=2>- if (!ehca_module->cache_qp)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create QP SLAB cache.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+ ret = ehca_init_qp_cache();</font></tt>
<br><tt><font size=2>+ if (ret) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create QP SLAB cache.");</font></tt>
<br><tt><font size=2>
goto create_slab_caches3;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ehca_module->cache_av
=</font></tt>
<br><tt><font size=2>-
kmem_cache_create("ehca_cache_av",</font></tt>
<br><tt><font size=2>-
sizeof(struct ehca_av),</font></tt>
<br><tt><font size=2>-
0, SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>-
NULL, NULL);</font></tt>
<br><tt><font size=2>- if (!ehca_module->cache_av)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create AV SLAB cache.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+ ret = ehca_init_av_cache();</font></tt>
<br><tt><font size=2>+ if (ret) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create AV SLAB cache.");</font></tt>
<br><tt><font size=2>
goto create_slab_caches4;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ehca_module->cache_mw
=</font></tt>
<br><tt><font size=2>-
kmem_cache_create("ehca_cache_mw",</font></tt>
<br><tt><font size=2>-
sizeof(struct ehca_mw),</font></tt>
<br><tt><font size=2>-
0, SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>-
NULL, NULL);</font></tt>
<br><tt><font size=2>- if (!ehca_module->cache_mw)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create MW SLAB cache.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+ ret = ehca_init_mrmw_cache();</font></tt>
<br><tt><font size=2>+ if (ret) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create MR&MW SLAB cache.");</font></tt>
<br><tt><font size=2>
goto create_slab_caches5;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ehca_module->cache_mr
=</font></tt>
<br><tt><font size=2>-
kmem_cache_create("ehca_cache_mr",</font></tt>
<br><tt><font size=2>-
sizeof(struct ehca_mr),</font></tt>
<br><tt><font size=2>-
0, SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>-
NULL, NULL);</font></tt>
<br><tt><font size=2>- if (!ehca_module->cache_mr)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create MR SLAB cache.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto create_slab_caches6;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-create_slab_caches6:</font></tt>
<br><tt><font size=2>- kmem_cache_destroy(ehca_module->cache_mw);</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_slab_caches5:</font></tt>
<br><tt><font size=2>- kmem_cache_destroy(ehca_module->cache_av);</font></tt>
<br><tt><font size=2>+ ehca_cleanup_av_cache();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_slab_caches4:</font></tt>
<br><tt><font size=2>- kmem_cache_destroy(ehca_module->cache_qp);</font></tt>
<br><tt><font size=2>+ ehca_cleanup_qp_cache();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_slab_caches3:</font></tt>
<br><tt><font size=2>- kmem_cache_destroy(ehca_module->cache_cq);</font></tt>
<br><tt><font size=2>+ ehca_cleanup_cq_cache();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_slab_caches2:</font></tt>
<br><tt><font size=2>- kmem_cache_destroy(ehca_module->cache_pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-create_slab_caches1:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ ehca_cleanup_pd_cache();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-int ehca_destroy_slab_caches(struct ehca_module *ehca_module)</font></tt>
<br><tt><font size=2>+static void ehca_destroy_slab_caches(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = kmem_cache_destroy(ehca_module->cache_pd);</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy PD SLAB cache. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = kmem_cache_destroy(ehca_module->cache_cq);</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy CQ SLAB cache. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = kmem_cache_destroy(ehca_module->cache_qp);</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy QP SLAB cache. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = kmem_cache_destroy(ehca_module->cache_av);</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy AV SLAB cache. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = kmem_cache_destroy(ehca_module->cache_mw);</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy MW SLAB cache. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = kmem_cache_destroy(ehca_module->cache_mr);</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy MR SLAB cache. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return 0;</font></tt>
<br><tt><font size=2>+ ehca_cleanup_mrmw_cache();</font></tt>
<br><tt><font size=2>+ ehca_cleanup_av_cache();</font></tt>
<br><tt><font size=2>+ ehca_cleanup_qp_cache();</font></tt>
<br><tt><font size=2>+ ehca_cleanup_cq_cache();</font></tt>
<br><tt><font size=2>+ ehca_cleanup_pd_cache();</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #define EHCA_HCAAVER EHCA_BMASK_IBM(32,39)</font></tt>
<br><tt><font size=2>@@ -260,22 +163,20 @@ int ehca_destroy_slab_caches(struct
ehca</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_sense_attributes(struct ehca_shca *shca)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = -EINVAL;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ int ret = 0;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> struct hipz_query_hca
*rblock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot allocate rblock memory.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto num_ports0;</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot allocate rblock memory.");</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_query_hca(shca->ipz_hca_handle, rblock);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot query device properties.
h_ret=%lx", h_ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot query device properties.
h_ret=%lx",</font></tt>
<br><tt><font size=2>+
h_ret);</font></tt>
<br><tt><font size=2>
ret = -EPERM;</font></tt>
<br><tt><font size=2>
goto num_ports1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -285,7 +186,7 @@ int ehca_sense_attributes(struct
ehca_sh</font></tt>
<br><tt><font size=2> else</font></tt>
<br><tt><font size=2>
shca->num_ports = (u8)rblock->num_ports;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(6, "
... found %x ports", rblock->num_ports);</font></tt>
<br><tt><font size=2>+ ehca_gen_dbg("
... found %x ports", rblock->num_ports);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ehca_hw_level
== 0) {</font></tt>
<br><tt><font size=2>
u32 hcaaver;</font></tt>
<br><tt><font size=2>@@ -294,8 +195,7 @@ int ehca_sense_attributes(struct
ehca_sh</font></tt>
<br><tt><font size=2>
hcaaver = EHCA_BMASK_GET(EHCA_HCAAVER, rblock->hw_ver);</font></tt>
<br><tt><font size=2>
revid = EHCA_BMASK_GET(EHCA_REVID, rblock->hw_ver);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(6, " ... hardware version=%x:%x",</font></tt>
<br><tt><font size=2>-
hcaaver, revid);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg(" ... hardware version=%x:%x",
hcaaver, revid);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if ((hcaaver == 1) && (revid == 0))</font></tt>
<br><tt><font size=2>
shca->hw_level
= 0;</font></tt>
<br><tt><font size=2>@@ -304,58 +204,43 @@ int ehca_sense_attributes(struct
ehca_sh</font></tt>
<br><tt><font size=2>
else if ((hcaaver == 1) && (revid ==
2))</font></tt>
<br><tt><font size=2>
shca->hw_level
= 2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- EDEB(6, "
... hardware level=%x", shca->hw_level);</font></tt>
<br><tt><font size=2>+ ehca_gen_dbg("
... hardware level=%x", shca->hw_level);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> shca->sport[0].rate
= IB_RATE_30_GBPS;</font></tt>
<br><tt><font size=2> shca->sport[1].rate
= IB_RATE_30_GBPS;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> num_ports1:</font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-num_ports0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-static int init_node_guid(struct ehca_shca* shca)</font></tt>
<br><tt><font size=2>+static int init_node_guid(struct ehca_shca *shca)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2> struct hipz_query_hca
*rblock;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!rblock)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate rblock memory.");</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
goto init_node_guid0;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't allocate
rblock memory.");</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (hipz_h_query_hca(shca->ipz_hca_handle,
rblock) != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't query device properties");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Can't query
device properties");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto init_node_guid1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- memcpy(&shca->ib_device.node_guid,
&rblock->node_guid, (sizeof(u64)));</font></tt>
<br><tt><font size=2>+ memcpy(&shca->ib_device.node_guid,
&rblock->node_guid, sizeof(u64));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> init_node_guid1:</font></tt>
<br><tt><font size=2> kfree(rblock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-init_node_guid0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "node_guid=%lx
ret=%x", shca->ib_device.node_guid, ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_register_device(struct ehca_shca *shca)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = init_node_guid(shca);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>@@ -383,7 +268,7 @@ int ehca_register_device(struct
ehca_shc</font></tt>
<br><tt><font size=2>
(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)
|</font></tt>
<br><tt><font size=2>
(1ull << IB_USER_VERBS_CMD_DETACH_MCAST);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca->ib_device.node_type
= IB_NODE_CA;</font></tt>
<br><tt><font size=2>+ shca->ib_device.node_type
= RDMA_NODE_IB_CA;</font></tt>
<br><tt><font size=2> shca->ib_device.phys_port_cnt
= shca->num_ports;</font></tt>
<br><tt><font size=2> shca->ib_device.dma_device
= &shca->ibmebus_dev->ofdev.dev;</font></tt>
<br><tt><font size=2> shca->ib_device.query_device
= ehca_query_device;</font></tt>
<br><tt><font size=2>@@ -432,38 +317,35 @@ int ehca_register_device(struct
ehca_shc</font></tt>
<br><tt><font size=2> shca->ib_device.mmap
= ehca_mmap;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ib_register_device(&shca->ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"ib_register_device()
failed ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static int ehca_create_aqp1(struct ehca_shca
*shca, u32 port)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_sport
*sport;</font></tt>
<br><tt><font size=2>+ struct ehca_sport
*sport = &shca->sport[port - 1];</font></tt>
<br><tt><font size=2> struct ib_cq
*ibcq;</font></tt>
<br><tt><font size=2> struct ib_qp
*ibqp;</font></tt>
<br><tt><font size=2> struct ib_qp_init_attr
qp_init_attr;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
port=%x", shca, port);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- sport = &shca->sport[port
- 1];</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (sport->ibcq_aqp1)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "AQP1 CQ is already created.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "AQP1 CQ is
already created.");</font></tt>
<br><tt><font size=2>
return -EPERM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ibcq = ib_create_cq(&shca->ib_device,
NULL, NULL, (void*)(-1), 10);</font></tt>
<br><tt><font size=2> if (IS_ERR(ibcq))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create AQP1 CQ.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot create
AQP1 CQ.");</font></tt>
<br><tt><font size=2>
return PTR_ERR(ibcq);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> sport->ibcq_aqp1
= ibcq;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (sport->ibqp_aqp1)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "AQP1 QP is already created.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "AQP1 QP is
already created.");</font></tt>
<br><tt><font size=2>
ret = -EPERM;</font></tt>
<br><tt><font size=2>
goto create_aqp1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -484,84 +366,62 @@ static int ehca_create_aqp1(struct
ehca_</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ibqp = ib_create_qp(&shca->pd->ib_pd,
&qp_init_attr);</font></tt>
<br><tt><font size=2> if (IS_ERR(ibqp))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create AQP1 QP.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot create
AQP1 QP.");</font></tt>
<br><tt><font size=2>
ret = PTR_ERR(ibqp);</font></tt>
<br><tt><font size=2>
goto create_aqp1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> sport->ibqp_aqp1
= ibqp;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- goto create_aqp0;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_aqp1:</font></tt>
<br><tt><font size=2> ib_destroy_cq(sport->ibcq_aqp1);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-create_aqp0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static int ehca_destroy_aqp1(struct ehca_sport
*sport)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "sport=%p",
sport);</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ib_destroy_qp(sport->ibqp_aqp1);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy AQP1 QP. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-
goto destroy_aqp1;</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot destroy AQP1 QP. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ib_destroy_cq(sport->ibcq_aqp1);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy AQP1 CQ. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-destroy_aqp1:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot destroy AQP1 CQ. ret=%x",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-static ssize_t ehca_show_debug_mask(struct device_driver
*ddp, char *buf)</font></tt>
<br><tt><font size=2>+static ssize_t ehca_show_debug_level(struct device_driver
*ddp, char *buf)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int i;</font></tt>
<br><tt><font size=2>- int total = 0;</font></tt>
<br><tt><font size=2>- total += snprintf(buf
+ total, PAGE_SIZE - total, "%d",</font></tt>
<br><tt><font size=2>-
ehca_edeb_mask[0]);</font></tt>
<br><tt><font size=2>- for (i = 1; i
< EHCA_EDEB_TRACE_MASK_SIZE; i++) {</font></tt>
<br><tt><font size=2>-
total += snprintf(buf + total, PAGE_SIZE - total,
"%d",</font></tt>
<br><tt><font size=2>-
ehca_edeb_mask[i]);</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- total += snprintf(buf
+ total, PAGE_SIZE - total, "\n");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return total;</font></tt>
<br><tt><font size=2>+ return snprintf(buf,
PAGE_SIZE, "%d\n",</font></tt>
<br><tt><font size=2>+
ehca_debug_level);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-static ssize_t ehca_store_debug_mask(struct device_driver
*ddp,</font></tt>
<br><tt><font size=2>-
const char *buf, size_t count)</font></tt>
<br><tt><font size=2>+static ssize_t ehca_store_debug_level(struct device_driver
*ddp,</font></tt>
<br><tt><font size=2>+
const char *buf, size_t count)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int i;</font></tt>
<br><tt><font size=2>- for (i = 0; i
< EHCA_EDEB_TRACE_MASK_SIZE; i++) {</font></tt>
<br><tt><font size=2>-
char value = buf[i] - '0';</font></tt>
<br><tt><font size=2>-
if ((value <= 9) && (count >= i)) {</font></tt>
<br><tt><font size=2>-
ehca_edeb_mask[i]
= value;</font></tt>
<br><tt><font size=2>-
}</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- return count;</font></tt>
<br><tt><font size=2>+ int value = (*buf)
- '0';</font></tt>
<br><tt><font size=2>+ if (value >=
0 && value <= 9)</font></tt>
<br><tt><font size=2>+
ehca_debug_level = value;</font></tt>
<br><tt><font size=2>+ return 1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>-DRIVER_ATTR(debug_mask, S_IRUSR | S_IWUSR,</font></tt>
<br><tt><font size=2>- ehca_show_debug_mask,
ehca_store_debug_mask);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+DRIVER_ATTR(debug_level, S_IRUSR | S_IWUSR,</font></tt>
<br><tt><font size=2>+ ehca_show_debug_level,
ehca_store_debug_level);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> void ehca_create_driver_sysfs(struct ibmebus_driver
*drv)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- driver_create_file(&drv->driver,
&driver_attr_debug_mask);</font></tt>
<br><tt><font size=2>+ driver_create_file(&drv->driver,
&driver_attr_debug_level);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> void ehca_remove_driver_sysfs(struct ibmebus_driver
*drv)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- driver_remove_file(&drv->driver,
&driver_attr_debug_mask);</font></tt>
<br><tt><font size=2>+ driver_remove_file(&drv->driver,
&driver_attr_debug_level);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #define EHCA_RESOURCE_ATTR(name)
\</font></tt>
<br><tt><font size=2>@@ -577,14 +437,14 @@ static ssize_t ehca_show_##name(struct
</font></tt>
<br><tt><font size=2>
\</font></tt>
<br><tt><font size=2> rblock =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
\</font></tt>
<br><tt><font size=2> if (!rblock)
{
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate rblock memory.");
\</font></tt>
<br><tt><font size=2>+
dev_err(dev, "Can't allocate rblock memory.");
\</font></tt>
<br><tt><font size=2>
return 0;
\</font></tt>
<br><tt><font size=2> }
\</font></tt>
<br><tt><font size=2>
\</font></tt>
<br><tt><font size=2> if (hipz_h_query_hca(shca->ipz_hca_handle,
rblock) != H_SUCCESS) { \</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't
query device properties");
\</font></tt>
<br><tt><font size=2>-
kfree(rblock);
\</font></tt>
<br><tt><font size=2>-
return 0;
\</font></tt>
<br><tt><font size=2>+
dev_err(dev, "Can't query device properties");
\</font></tt>
<br><tt><font size=2>+
kfree(rblock);
\</font></tt>
<br><tt><font size=2>+
return 0;
\</font></tt>
<br><tt><font size=2> }
\</font></tt>
<br><tt><font size=2>
\</font></tt>
<br><tt><font size=2> data = rblock->name;
\</font></tt>
<br><tt><font size=2>@@ -669,26 +529,24 @@ static int __devinit ehca_probe(struct
i</font></tt>
<br><tt><font size=2> struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2> u64 *handle;</font></tt>
<br><tt><font size=2> struct ib_pd
*ibpd;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> handle =
(u64 *)get_property(dev->ofdev.node, "ibm,hca-handle", NULL);</font></tt>
<br><tt><font size=2> if (!handle)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot get eHCA handle for adapter:
%s.",</font></tt>
<br><tt><font size=2>-
dev->ofdev.node->full_name);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot get eHCA handle for adapter:
%s.",</font></tt>
<br><tt><font size=2>+
dev->ofdev.node->full_name);</font></tt>
<br><tt><font size=2>
return -ENODEV;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (!(*handle))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Wrong eHCA handle for adapter: %s.",</font></tt>
<br><tt><font size=2>-
dev->ofdev.node->full_name);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Wrong eHCA handle for adapter:
%s.",</font></tt>
<br><tt><font size=2>+
dev->ofdev.node->full_name);</font></tt>
<br><tt><font size=2>
return -ENODEV;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> shca = (struct
ehca_shca *)ib_alloc_device(sizeof(*shca));</font></tt>
<br><tt><font size=2>- if (shca == NULL)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot allocate shca memory.");</font></tt>
<br><tt><font size=2>+ if (!shca) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot allocate shca memory.");</font></tt>
<br><tt><font size=2>
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -698,29 +556,35 @@ static int __devinit ehca_probe(struct
i</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_sense_attributes(shca);</font></tt>
<br><tt><font size=2> if (ret
< 0) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot sense eHCA attributes.");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot sense eHCA attributes.");</font></tt>
<br><tt><font size=2>+
goto probe1;</font></tt>
<br><tt><font size=2>+ }</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ ret = ehca_register_device(shca);</font></tt>
<br><tt><font size=2>+ if (ret) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot register Infiniband device");</font></tt>
<br><tt><font size=2>
goto probe1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* create
event queues */</font></tt>
<br><tt><font size=2> ret = ehca_create_eq(shca,
&shca->eq, EHCA_EQ, 2048);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create EQ.");</font></tt>
<br><tt><font size=2>-
goto probe1;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot create
EQ.");</font></tt>
<br><tt><font size=2>+
goto probe2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_create_eq(shca,
&shca->neq, EHCA_NEQ, 513);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create NEQ.");</font></tt>
<br><tt><font size=2>-
goto probe2;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot create
NEQ.");</font></tt>
<br><tt><font size=2>+
goto probe3;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* create
internal protection domain */</font></tt>
<br><tt><font size=2> ibpd = ehca_alloc_pd(&shca->ib_device,
(void*)(-1), NULL);</font></tt>
<br><tt><font size=2> if (IS_ERR(ibpd))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create internal PD.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot create
internal PD.");</font></tt>
<br><tt><font size=2>
ret = PTR_ERR(ibpd);</font></tt>
<br><tt><font size=2>-
goto probe3;</font></tt>
<br><tt><font size=2>+
goto probe4;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> shca->pd
= container_of(ibpd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>@@ -730,13 +594,8 @@ static int __devinit ehca_probe(struct
i</font></tt>
<br><tt><font size=2> ret = ehca_reg_internal_maxmr(shca,
shca->pd, &shca->maxmr);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create internal MR. ret=%x",
ret);</font></tt>
<br><tt><font size=2>-
goto probe4;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_register_device(shca);</font></tt>
<br><tt><font size=2>- if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot register Infiniband device.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot create
internal MR ret=%x",</font></tt>
<br><tt><font size=2>+
ret);</font></tt>
<br><tt><font size=2>
goto probe5;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -745,7 +604,8 @@ static int __devinit ehca_probe(struct
i</font></tt>
<br><tt><font size=2>
shca->sport[0].port_state = IB_PORT_DOWN;</font></tt>
<br><tt><font size=2>
ret = ehca_create_aqp1(shca, 1);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot
create AQP1 for port 1.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot create AQP1 for port 1.");</font></tt>
<br><tt><font size=2>
goto probe6;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -755,54 +615,56 @@ static int __devinit ehca_probe(struct
i</font></tt>
<br><tt><font size=2>
shca->sport[1].port_state = IB_PORT_DOWN;</font></tt>
<br><tt><font size=2>
ret = ehca_create_aqp1(shca, 2);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot
create AQP1 for port 2.");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot create AQP1 for port 2.");</font></tt>
<br><tt><font size=2>
goto probe7;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_create_device_sysfs(dev);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- spin_lock(&ehca_module.shca_lock);</font></tt>
<br><tt><font size=2>- list_add(&shca->shca_list,
&ehca_module.shca_list);</font></tt>
<br><tt><font size=2>- spin_unlock(&ehca_module.shca_lock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ spin_lock(&shca_list_lock);</font></tt>
<br><tt><font size=2>+ list_add(&shca->shca_list,
&shca_list);</font></tt>
<br><tt><font size=2>+ spin_unlock(&shca_list_lock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe7:</font></tt>
<br><tt><font size=2> ret = ehca_destroy_aqp1(&shca->sport[0]);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy AQP1 for port 1.
ret=%x", ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy AQP1 for port 1. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe6:</font></tt>
<br><tt><font size=2>- ib_unregister_device(&shca->ib_device);</font></tt>
<br><tt><font size=2>+ ret = ehca_dereg_internal_maxmr(shca);</font></tt>
<br><tt><font size=2>+ if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy internal MR. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe5:</font></tt>
<br><tt><font size=2>- ret = ehca_dereg_internal_maxmr(shca);</font></tt>
<br><tt><font size=2>+ ret = ehca_dealloc_pd(&shca->pd->ib_pd);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy internal MR. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy internal PD. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe4:</font></tt>
<br><tt><font size=2>- ret = ehca_dealloc_pd(&shca->pd->ib_pd);</font></tt>
<br><tt><font size=2>- if (ret != 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy internal PD. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ ret = ehca_destroy_eq(shca,
&shca->neq);</font></tt>
<br><tt><font size=2>+ if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy NEQ. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe3:</font></tt>
<br><tt><font size=2>- ret = ehca_destroy_eq(shca,
&shca->neq);</font></tt>
<br><tt><font size=2>- if (ret != 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy NEQ. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ ret = ehca_destroy_eq(shca,
&shca->eq);</font></tt>
<br><tt><font size=2>+ if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy EQ. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe2:</font></tt>
<br><tt><font size=2>- ret = ehca_destroy_eq(shca,
&shca->eq);</font></tt>
<br><tt><font size=2>- if (ret != 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy EQ. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ ib_unregister_device(&shca->ib_device);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> probe1:</font></tt>
<br><tt><font size=2> ib_dealloc_device(&shca->ib_device);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(4, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -811,18 +673,16 @@ static int __devexit ehca_remove(struct
</font></tt>
<br><tt><font size=2> struct ehca_shca
*shca = dev->ofdev.dev.driver_data;</font></tt>
<br><tt><font size=2> int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p",
shca);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ehca_remove_device_sysfs(dev);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ehca_open_aqp1
== 1) {</font></tt>
<br><tt><font size=2>
int i;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>
for (i = 0; i < shca->num_ports; i++)
{</font></tt>
<br><tt><font size=2>
ret = ehca_destroy_aqp1(&shca->sport[i]);</font></tt>
<br><tt><font size=2>-
if (ret != 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy AQP1 for port %x."</font></tt>
<br><tt><font size=2>-
" ret=%x",
ret, i);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy AQP1 for port %x "</font></tt>
<br><tt><font size=2>+
"ret=%x",
ret, i);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -830,27 +690,27 @@ static int __devexit ehca_remove(struct
</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_dereg_internal_maxmr(shca);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy internal MR. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy internal MR. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_dealloc_pd(&shca->pd->ib_pd);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy internal PD. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Cannot
destroy internal PD. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_destroy_eq(shca,
&shca->eq);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy EQ. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Cannot destroy
EQ. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_destroy_eq(shca,
&shca->neq);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Canot destroy NEQ. ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Canot destroy
NEQ. ret=%x", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ib_dealloc_device(&shca->ib_device);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- spin_lock(&ehca_module.shca_lock);</font></tt>
<br><tt><font size=2>+ spin_lock(&shca_list_lock);</font></tt>
<br><tt><font size=2> list_del(&shca->shca_list);</font></tt>
<br><tt><font size=2>- spin_unlock(&ehca_module.shca_lock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>+ spin_unlock(&shca_list_lock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -871,37 +731,46 @@ static struct ibmebus_driver
ehca_driver</font></tt>
<br><tt><font size=2> .remove
= ehca_remove,</font></tt>
<br><tt><font size=2> };</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+void ehca_poll_eqs(unsigned long data)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ spin_lock(&shca_list_lock);</font></tt>
<br><tt><font size=2>+ list_for_each_entry(shca,
&shca_list, shca_list) {</font></tt>
<br><tt><font size=2>+
if (shca->eq.is_initialized)</font></tt>
<br><tt><font size=2>+
ehca_tasklet_eq((unsigned
long)(void*)shca);</font></tt>
<br><tt><font size=2>+ }</font></tt>
<br><tt><font size=2>+ mod_timer(&poll_eqs_timer,
jiffies + HZ);</font></tt>
<br><tt><font size=2>+ spin_unlock(&shca_list_lock);</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> int __init ehca_module_init(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> printk(KERN_INFO
"eHCA Infiniband Device Driver "</font></tt>
<br><tt><font size=2>-
"(Rel.: SVNEHCA_0012)\n");</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+
"(Rel.: SVNEHCA_0015)\n");</font></tt>
<br><tt><font size=2> idr_init(&ehca_qp_idr);</font></tt>
<br><tt><font size=2> idr_init(&ehca_cq_idr);</font></tt>
<br><tt><font size=2> spin_lock_init(&ehca_qp_idr_lock);</font></tt>
<br><tt><font size=2> spin_lock_init(&ehca_cq_idr_lock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- INIT_LIST_HEAD(&ehca_module.shca_list);</font></tt>
<br><tt><font size=2>- spin_lock_init(&ehca_module.shca_lock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ehca_init_trace();</font></tt>
<br><tt><font size=2>+ INIT_LIST_HEAD(&shca_list);</font></tt>
<br><tt><font size=2>+ spin_lock_init(&shca_list_lock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if ((ret
= ehca_create_comp_pool())) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create comp pool.");</font></tt>
<br><tt><font size=2>-
goto module_init0;</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create comp pool.");</font></tt>
<br><tt><font size=2>+
return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if ((ret = ehca_create_slab_caches(&ehca_module)))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot create SLAB caches");</font></tt>
<br><tt><font size=2>+ if ((ret = ehca_create_slab_caches()))
{</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot create SLAB caches");</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>
goto module_init1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if ((ret
= ibmebus_register_driver(&ehca_driver))) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot register eHCA device driver");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Cannot register eHCA device driver");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto module_init2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -909,49 +778,39 @@ int __init ehca_module_init(void)</font></tt>
<br><tt><font size=2> ehca_create_driver_sysfs(&ehca_driver);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ehca_poll_all_eqs
!= 1) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "WARNING!!!");</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "It is possible to lose interrupts.");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("WARNING!!!");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("It is possible to lose interrupts.");</font></tt>
<br><tt><font size=2> } else {</font></tt>
<br><tt><font size=2>-
init_timer(&ehca_module.timer);</font></tt>
<br><tt><font size=2>-
ehca_module.timer.function = ehca_poll_eqs;</font></tt>
<br><tt><font size=2>-
ehca_module.timer.data = (unsigned long)&ehca_module;</font></tt>
<br><tt><font size=2>-
ehca_module.timer.expires = jiffies + HZ;</font></tt>
<br><tt><font size=2>-
add_timer(&ehca_module.timer);</font></tt>
<br><tt><font size=2>+
init_timer(&poll_eqs_timer);</font></tt>
<br><tt><font size=2>+
poll_eqs_timer.function = ehca_poll_eqs;</font></tt>
<br><tt><font size=2>+
poll_eqs_timer.expires = jiffies + HZ;</font></tt>
<br><tt><font size=2>+
add_timer(&poll_eqs_timer);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- goto module_init0;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> module_init2:</font></tt>
<br><tt><font size=2>- ehca_destroy_slab_caches(&ehca_module);</font></tt>
<br><tt><font size=2>+ ehca_destroy_slab_caches();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> module_init1:</font></tt>
<br><tt><font size=2> ehca_destroy_comp_pool();</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-module_init0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> };</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> void __exit ehca_module_exit(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (ehca_poll_all_eqs
== 1)</font></tt>
<br><tt><font size=2>-
del_timer_sync(&ehca_module.timer);</font></tt>
<br><tt><font size=2>+
del_timer_sync(&poll_eqs_timer);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_remove_driver_sysfs(&ehca_driver);</font></tt>
<br><tt><font size=2> ibmebus_unregister_driver(&ehca_driver);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (ehca_destroy_slab_caches(&ehca_module)
!= 0)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot destroy SLAB caches");</font></tt>
<br><tt><font size=2>+ ehca_destroy_slab_caches();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_destroy_comp_pool();</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> idr_destroy(&ehca_cq_idr);</font></tt>
<br><tt><font size=2> idr_destroy(&ehca_qp_idr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "");</font></tt>
<br><tt><font size=2> };</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> module_init(ehca_module_init);</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_mcast.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_mcast.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_mcast.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_mcast.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -42,54 +42,38 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "mcas"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <linux/module.h></font></tt>
<br><tt><font size=2> #include <linux/err.h></font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2> #include "ehca_qes.h"</font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #define MAX_MC_LID 0xFFFE</font></tt>
<br><tt><font size=2> #define MIN_MC_LID 0xC000
/* Multicast limits */</font></tt>
<br><tt><font size=2> #define EHCA_VALID_MULTICAST_GID(gid) ((gid)[0]
== 0xFF)</font></tt>
<br><tt><font size=2>-#define EHCA_VALID_MULTICAST_LID(lid) (((lid)
>= MIN_MC_LID) && ((lid) <= MAX_MC_LID))</font></tt>
<br><tt><font size=2>+#define EHCA_VALID_MULTICAST_LID(lid) \</font></tt>
<br><tt><font size=2>+ (((lid) >=
MIN_MC_LID) && ((lid) <= MAX_MC_LID))</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_attach_mcast(struct ib_qp *ibqp, union
ib_gid *gid, u16 lid)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(ibqp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibqp->device, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2> union ib_gid
my_gid;</font></tt>
<br><tt><font size=2>- u64 subnet_prefix;</font></tt>
<br><tt><font size=2>- u64 interface_id;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ibqp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(gid);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_qp = container_of(ibqp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ u64 subnet_prefix,
interface_id, h_ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_QP(my_qp);</font></tt>
<br><tt><font size=2> if (ibqp->qp_type
!= IB_QPT_UD) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "invalid qp_type %x gid, ret=%x",</font></tt>
<br><tt><font size=2>-
ibqp->qp_type,
EINVAL);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "invalid qp_type=%x",
ibqp->qp_type);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(ibqp->pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(shca);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (!(EHCA_VALID_MULTICAST_GID(gid->raw)))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "gid is not valid mulitcast gid ret=%x",</font></tt>
<br><tt><font size=2>-
EINVAL);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "invalid mulitcast
gid");</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> } else if
((lid < MIN_MC_LID) || (lid > MAX_MC_LID)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "lid=%x is not valid mulitcast lid
ret=%x",</font></tt>
<br><tt><font size=2>-
lid, EINVAL);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "invalid mulitcast
lid=%x", lid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -101,100 +85,47 @@ int ehca_attach_mcast(struct
ib_qp *ibqp</font></tt>
<br><tt><font size=2>
my_qp->ipz_qp_handle,</font></tt>
<br><tt><font size=2>
my_qp->galpas.kernel,</font></tt>
<br><tt><font size=2>
lid, subnet_prefix, interface_id);</font></tt>
<br><tt><font size=2>- if (h_ret !=
H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,</font></tt>
<br><tt><font size=2>+ if (h_ret !=
H_SUCCESS)</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x hipz_h_attach_mcqp() failed "</font></tt>
<br><tt><font size=2>
"h_ret=%lx",
my_qp, ibqp->qp_num, h_ret);</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "mcast
attach ret=%x\n"</font></tt>
<br><tt><font size=2>-
"ehca_qp=%p qp_num=%x lid=%x\n"</font></tt>
<br><tt><font size=2>-
"my_gid= %x %x %x %x\n"</font></tt>
<br><tt><font size=2>-
" %x %x %x
%x\n"</font></tt>
<br><tt><font size=2>-
" %x %x %x
%x\n"</font></tt>
<br><tt><font size=2>-
" %x %x %x
%x\n",</font></tt>
<br><tt><font size=2>-
ret, my_qp, ibqp->qp_num, lid,</font></tt>
<br><tt><font size=2>-
my_gid.raw[0], my_gid.raw[1],</font></tt>
<br><tt><font size=2>-
my_gid.raw[2], my_gid.raw[3],</font></tt>
<br><tt><font size=2>-
my_gid.raw[4], my_gid.raw[5],</font></tt>
<br><tt><font size=2>-
my_gid.raw[6], my_gid.raw[7],</font></tt>
<br><tt><font size=2>-
my_gid.raw[8], my_gid.raw[9],</font></tt>
<br><tt><font size=2>-
my_gid.raw[10], my_gid.raw[11],</font></tt>
<br><tt><font size=2>-
my_gid.raw[12], my_gid.raw[13],</font></tt>
<br><tt><font size=2>-
my_gid.raw[14], my_gid.raw[15]);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_detach_mcast(struct ib_qp *ibqp, union
ib_gid *gid, u16 lid)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(ibqp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibqp->pd->device,</font></tt>
<br><tt><font size=2>+
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> union ib_gid
my_gid;</font></tt>
<br><tt><font size=2>- u64 subnet_prefix;</font></tt>
<br><tt><font size=2>- u64 interface_id;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ibqp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(gid);</font></tt>
<br><tt><font size=2>+ u64 subnet_prefix,
interface_id, h_ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- my_qp = container_of(ibqp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_QP(my_qp);</font></tt>
<br><tt><font size=2> if (ibqp->qp_type
!= IB_QPT_UD) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "invalid qp_type %x gid, ret=%x",</font></tt>
<br><tt><font size=2>-
ibqp->qp_type,
EINVAL);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "invalid qp_type %x",
ibqp->qp_type);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(ibqp->pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(shca);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (!(EHCA_VALID_MULTICAST_GID(gid->raw)))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "gid is not valid mulitcast gid ret=%x",</font></tt>
<br><tt><font size=2>-
EINVAL);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "invalid mulitcast
gid");</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> } else if
((lid < MIN_MC_LID) || (lid > MAX_MC_LID)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "lid=%x is not valid mulitcast lid
ret=%x",</font></tt>
<br><tt><font size=2>-
lid, EINVAL);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "invalid mulitcast
lid=%x", lid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "dgid=%p
qp_numl=%x lid=%x",</font></tt>
<br><tt><font size=2>-
gid, ibqp->qp_num, lid);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> memcpy(&my_gid.raw,
gid->raw, sizeof(union ib_gid));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> subnet_prefix
= be64_to_cpu(my_gid.global.subnet_prefix);</font></tt>
<br><tt><font size=2> interface_id
= be64_to_cpu(my_gid.global.interface_id);</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_detach_mcqp(shca->ipz_hca_handle,</font></tt>
<br><tt><font size=2>-
my_qp->ipz_qp_handle,</font></tt>
<br><tt><font size=2>-
my_qp->galpas.kernel,</font></tt>
<br><tt><font size=2>-
lid, subnet_prefix, interface_id);</font></tt>
<br><tt><font size=2>- if (h_ret !=
H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,</font></tt>
<br><tt><font size=2>+
my_qp->ipz_qp_handle,</font></tt>
<br><tt><font size=2>+
my_qp->galpas.kernel,</font></tt>
<br><tt><font size=2>+
lid, subnet_prefix, interface_id);</font></tt>
<br><tt><font size=2>+ if (h_ret !=
H_SUCCESS)</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x hipz_h_detach_mcqp() failed "</font></tt>
<br><tt><font size=2>
"h_ret=%lx",
my_qp, ibqp->qp_num, h_ret);</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "mcast
detach ret=%x\n"</font></tt>
<br><tt><font size=2>-
"ehca_qp=%p qp_num=%x lid=%x\n"</font></tt>
<br><tt><font size=2>-
"my_gid= %x %x %x %x\n"</font></tt>
<br><tt><font size=2>-
" %x %x %x %x\n"</font></tt>
<br><tt><font size=2>-
" %x %x %x %x\n"</font></tt>
<br><tt><font size=2>-
" %x %x %x %x\n",</font></tt>
<br><tt><font size=2>-
ret, my_qp, ibqp->qp_num, lid,</font></tt>
<br><tt><font size=2>-
my_gid.raw[0], my_gid.raw[1],</font></tt>
<br><tt><font size=2>-
my_gid.raw[2], my_gid.raw[3],</font></tt>
<br><tt><font size=2>-
my_gid.raw[4], my_gid.raw[5],</font></tt>
<br><tt><font size=2>-
my_gid.raw[6], my_gid.raw[7],</font></tt>
<br><tt><font size=2>-
my_gid.raw[8], my_gid.raw[9],</font></tt>
<br><tt><font size=2>-
my_gid.raw[10], my_gid.raw[11],</font></tt>
<br><tt><font size=2>-
my_gid.raw[12], my_gid.raw[13],</font></tt>
<br><tt><font size=2>-
my_gid.raw[14], my_gid.raw[15]);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_mrmw.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_mrmw.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -39,9 +39,6 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#undef DEB_PREFIX</font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "mrmw"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/current.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2>@@ -49,78 +46,62 @@</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> #include "hipz_hw.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-extern int ehca_use_hp_mr;</font></tt>
<br><tt><font size=2>+static struct kmem_cache *mr_cache;</font></tt>
<br><tt><font size=2>+static struct kmem_cache *mw_cache;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static struct ehca_mr *ehca_mr_new(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2> struct ehca_mr
*me;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- me = kmem_cache_alloc(ehca_module.cache_mr,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2>+ me = kmem_cache_alloc(mr_cache,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2> if (me)
{</font></tt>
<br><tt><font size=2>
memset(me, 0, sizeof(struct ehca_mr));</font></tt>
<br><tt><font size=2>
spin_lock_init(&me->mrlock);</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ehca_mr=%p sizeof(ehca_mr_t)=%x",
me,</font></tt>
<br><tt><font size=2>-
(u32) sizeof(struct
ehca_mr));</font></tt>
<br><tt><font size=2>- } else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(3, "alloc failed");</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>+ } else</font></tt>
<br><tt><font size=2>+
ehca_gen_err("alloc failed");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return me;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static void ehca_mr_delete(struct ehca_mr *me)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_mr,
me);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(mr_cache,
me);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static struct ehca_mw *ehca_mw_new(void)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2> struct ehca_mw
*me;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- me = kmem_cache_alloc(ehca_module.cache_mw,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2>+ me = kmem_cache_alloc(mw_cache,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2> if (me)
{</font></tt>
<br><tt><font size=2>
memset(me, 0, sizeof(struct ehca_mw));</font></tt>
<br><tt><font size=2>
spin_lock_init(&me->mwlock);</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ehca_mw=%p sizeof(ehca_mw_t)=%x",
me,</font></tt>
<br><tt><font size=2>-
(u32) sizeof(struct
ehca_mw));</font></tt>
<br><tt><font size=2>- } else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(3, "alloc failed");</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>+ } else</font></tt>
<br><tt><font size=2>+
ehca_gen_err("alloc failed");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return me;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static void ehca_mw_delete(struct ehca_mw *me)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_mw,
me);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(mw_cache,
me);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /*----------------------------------------------------------------------*/</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd,
int mr_access_flags)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ib_mr
*ib_mr = NULL;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_maxmr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p
mr_access_flags=%x", pd, mr_access_flags);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- e_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ib_mr
*ib_mr;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_maxmr;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(pd->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (shca->maxmr)
{</font></tt>
<br><tt><font size=2>
e_maxmr = ehca_mr_new();</font></tt>
<br><tt><font size=2>
if (!e_maxmr) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "out
of memory");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"out of memory");</font></tt>
<br><tt><font size=2>
ib_mr =
ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>
goto get_dma_mr_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -135,18 +116,15 @@ struct ib_mr *ehca_get_dma_mr(struct
ib_</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
ib_mr = &e_maxmr->ib.ib_mr;</font></tt>
<br><tt><font size=2> } else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "no internal max-MR exist!");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "no internal
max-MR exist!");</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto get_dma_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> get_dma_mr_exit0:</font></tt>
<br><tt><font size=2> if (IS_ERR(ib_mr))</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "rc=%lx pd=%p mr_access_flags=%x ",</font></tt>
<br><tt><font size=2>-
PTR_ERR(ib_mr),
pd, mr_access_flags);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ib_mr=%p lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
ib_mr, ib_mr->lkey,
ib_mr->rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "rc=%lx pd=%p
mr_access_flags=%x ",</font></tt>
<br><tt><font size=2>+
PTR_ERR(ib_mr),
pd, mr_access_flags);</font></tt>
<br><tt><font size=2> return ib_mr;</font></tt>
<br><tt><font size=2> } /* end ehca_get_dma_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -158,23 +136,20 @@ struct ib_mr *ehca_reg_phys_mr(struct
ib</font></tt>
<br><tt><font size=2>
int mr_access_flags,</font></tt>
<br><tt><font size=2>
u64 *iova_start)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ib_mr
*ib_mr = NULL;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_mr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>- u64 size = 0;</font></tt>
<br><tt><font size=2>+ struct ib_mr
*ib_mr;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_mr;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(pd->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ u64 size;</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2>- u32 num_pages_mr
= 0;</font></tt>
<br><tt><font size=2>- u32 num_pages_4k
= 0; /* 4k portion "pages" */</font></tt>
<br><tt><font size=2>+ u32 num_pages_mr;</font></tt>
<br><tt><font size=2>+ u32 num_pages_4k;
/* 4k portion "pages" */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p
phys_buf_array=%p num_phys_buf=%x "</font></tt>
<br><tt><font size=2>-
"mr_access_flags=%x iova_start=%p", pd,
phys_buf_array,</font></tt>
<br><tt><font size=2>-
num_phys_buf, mr_access_flags, iova_start);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- if ((num_phys_buf
<= 0) || ehca_adr_bad(phys_buf_array)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: num_phys_buf=%x
"</font></tt>
<br><tt><font size=2>+ if ((num_phys_buf
<= 0) || !phys_buf_array) {</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: num_phys_buf=%x
"</font></tt>
<br><tt><font size=2>
"phys_buf_array=%p",
num_phys_buf, phys_buf_array);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>@@ -187,7 +162,7 @@ struct ib_mr *ehca_reg_phys_mr(struct
ib</font></tt>
<br><tt><font size=2>
* Remote Write Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
* Remote Atomic Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>
mr_access_flags);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>@@ -202,18 +177,15 @@ struct ib_mr *ehca_reg_phys_mr(struct
ib</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if ((size
== 0) ||</font></tt>
<br><tt><font size=2>
(((u64)iova_start + size) < (u64)iova_start)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: size=%lx iova_start=%p",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: size=%lx
iova_start=%p",</font></tt>
<br><tt><font size=2>
size,
iova_start);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_phys_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> e_mr = ehca_mr_new();</font></tt>
<br><tt><font size=2> if (!e_mr)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "out of memory");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "out of memory");</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>
goto reg_phys_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -253,20 +225,16 @@ struct ib_mr *ehca_reg_phys_mr(struct
ib</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* successful
registration of all pages */</font></tt>
<br><tt><font size=2>- ib_mr = &e_mr->ib.ib_mr;</font></tt>
<br><tt><font size=2>- goto reg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>+ return &e_mr->ib.ib_mr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> reg_phys_mr_exit1:</font></tt>
<br><tt><font size=2> ehca_mr_delete(e_mr);</font></tt>
<br><tt><font size=2> reg_phys_mr_exit0:</font></tt>
<br><tt><font size=2> if (IS_ERR(ib_mr))</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "rc=%lx pd=%p phys_buf_array=%p "</font></tt>
<br><tt><font size=2>-
"num_phys_buf=%x
mr_access_flags=%x iova_start=%p",</font></tt>
<br><tt><font size=2>-
PTR_ERR(ib_mr),
pd, phys_buf_array,</font></tt>
<br><tt><font size=2>-
num_phys_buf,
mr_access_flags, iova_start);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ib_mr=%p lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
ib_mr, ib_mr->lkey,
ib_mr->rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "rc=%lx pd=%p phys_buf_array=%p
"</font></tt>
<br><tt><font size=2>+
"num_phys_buf=%x
mr_access_flags=%x iova_start=%p",</font></tt>
<br><tt><font size=2>+
PTR_ERR(ib_mr),
pd, phys_buf_array,</font></tt>
<br><tt><font size=2>+
num_phys_buf,
mr_access_flags, iova_start);</font></tt>
<br><tt><font size=2> return ib_mr;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_phys_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -277,21 +245,22 @@ struct ib_mr *ehca_reg_user_mr(struct
ib</font></tt>
<br><tt><font size=2>
int mr_access_flags,</font></tt>
<br><tt><font size=2>
struct ib_udata *udata)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ib_mr
*ib_mr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_mr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ib_mr
*ib_mr;</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_mr;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(pd->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u32 num_pages_mr
= 0;</font></tt>
<br><tt><font size=2>- u32 num_pages_4k
= 0; /* 4k portion "pages" */</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p
region=%p mr_access_flags=%x udata=%p",</font></tt>
<br><tt><font size=2>-
pd, region, mr_access_flags, udata);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- if (ehca_adr_bad(region))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: region=%p",
region);</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ u32 num_pages_mr;</font></tt>
<br><tt><font size=2>+ u32 num_pages_4k;
/* 4k portion "pages" */</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ if (!pd) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad pd=%p", pd);</font></tt>
<br><tt><font size=2>+
return ERR_PTR(-EFAULT);</font></tt>
<br><tt><font size=2>+ }</font></tt>
<br><tt><font size=2>+ if (!region)
{</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: region=%p",
region);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_user_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -303,36 +272,29 @@ struct ib_mr *ehca_reg_user_mr(struct
ib</font></tt>
<br><tt><font size=2>
* Remote Write Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
* Remote Atomic Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>
mr_access_flags);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_user_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- EDEB(7, "user_base=%lx
virt_base=%lx length=%lx offset=%x page_size=%x "</font></tt>
<br><tt><font size=2>-
"chunk_list.next=%p",</font></tt>
<br><tt><font size=2>-
region->user_base, region->virt_base, region->length,</font></tt>
<br><tt><font size=2>-
region->offset, region->page_size, region->chunk_list.next);</font></tt>
<br><tt><font size=2> if (region->page_size
!= PAGE_SIZE) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "page size not supported, region->page_size=%x",</font></tt>
<br><tt><font size=2>-
region->page_size);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "page size not supported,
"</font></tt>
<br><tt><font size=2>+
"region->page_size=%x",
region->page_size);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_user_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if ((region->length
== 0) ||</font></tt>
<br><tt><font size=2>
((region->virt_base + region->length) < region->virt_base))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: length=%lx virt_base=%lx",</font></tt>
<br><tt><font size=2>-
region->length,
region->virt_base);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: length=%lx
"</font></tt>
<br><tt><font size=2>+
"virt_base=%lx",
region->length, region->virt_base);</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto reg_user_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> e_mr = ehca_mr_new();</font></tt>
<br><tt><font size=2> if (!e_mr)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "out of memory");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "out of memory");</font></tt>
<br><tt><font size=2>
ib_mr = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>
goto reg_user_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -362,19 +324,15 @@ struct ib_mr *ehca_reg_user_mr(struct
ib</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* successful
registration of all pages */</font></tt>
<br><tt><font size=2>- ib_mr = &e_mr->ib.ib_mr;</font></tt>
<br><tt><font size=2>- goto reg_user_mr_exit0;</font></tt>
<br><tt><font size=2>+ return &e_mr->ib.ib_mr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> reg_user_mr_exit1:</font></tt>
<br><tt><font size=2> ehca_mr_delete(e_mr);</font></tt>
<br><tt><font size=2> reg_user_mr_exit0:</font></tt>
<br><tt><font size=2> if (IS_ERR(ib_mr))</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "rc=%lx pd=%p region=%p mr_access_flags=%x
"</font></tt>
<br><tt><font size=2>-
"udata=%p",</font></tt>
<br><tt><font size=2>-
PTR_ERR(ib_mr),
pd, region, mr_access_flags, udata);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ib_mr=%p lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
ib_mr, ib_mr->lkey,
ib_mr->rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "rc=%lx pd=%p region=%p
mr_access_flags=%x"</font></tt>
<br><tt><font size=2>+
" udata=%p",</font></tt>
<br><tt><font size=2>+
PTR_ERR(ib_mr),
pd, region, mr_access_flags, udata);</font></tt>
<br><tt><font size=2> return ib_mr;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_user_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -388,32 +346,26 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2>
int mr_access_flags,</font></tt>
<br><tt><font size=2>
u64 *iova_start)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_mr = NULL;</font></tt>
<br><tt><font size=2>- u64 new_size
= 0;</font></tt>
<br><tt><font size=2>- u64 *new_start
= NULL;</font></tt>
<br><tt><font size=2>- u32 new_acl =
0;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*new_pd = NULL;</font></tt>
<br><tt><font size=2>- u32 tmp_lkey
= 0;</font></tt>
<br><tt><font size=2>- u32 tmp_rkey
= 0;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(mr->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_mr = container_of(mr, struct ehca_mr, ib.ib_mr);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+ u64 new_size;</font></tt>
<br><tt><font size=2>+ u64 *new_start;</font></tt>
<br><tt><font size=2>+ u32 new_acl;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*new_pd;</font></tt>
<br><tt><font size=2>+ u32 tmp_lkey,
tmp_rkey;</font></tt>
<br><tt><font size=2> unsigned
long sl_flags;</font></tt>
<br><tt><font size=2> u32 num_pages_mr
= 0;</font></tt>
<br><tt><font size=2> u32 num_pages_4k
= 0; /* 4k portion "pages" */</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "mr=%p
mr_rereg_mask=%x pd=%p phys_buf_array=%p "</font></tt>
<br><tt><font size=2>-
"num_phys_buf=%x mr_access_flags=%x iova_start=%p",</font></tt>
<br><tt><font size=2>-
mr, mr_rereg_mask, pd, phys_buf_array, num_phys_buf,</font></tt>
<br><tt><font size=2>-
mr_access_flags, iova_start);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_MR(mr);</font></tt>
<br><tt><font size=2>- my_pd = container_of(mr->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
(my_pd->ownpid != cur_pid)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>@@ -421,15 +373,19 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (!(mr_rereg_mask
& IB_MR_REREG_TRANS)) {</font></tt>
<br><tt><font size=2>
/* TODO not supported, because PHYP rereg hCall
needs pages */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "rereg without IB_MR_REREG_TRANS
not supported yet,"</font></tt>
<br><tt><font size=2>-
" mr_rereg_mask=%x",
mr_rereg_mask);</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "rereg without IB_MR_REREG_TRANS
not "</font></tt>
<br><tt><font size=2>+
"supported
yet, mr_rereg_mask=%x", mr_rereg_mask);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_mr = container_of(mr,
struct ehca_mr, ib.ib_mr);</font></tt>
<br><tt><font size=2> if (mr_rereg_mask
& IB_MR_REREG_PD) {</font></tt>
<br><tt><font size=2>-
EHCA_CHECK_PD(pd);</font></tt>
<br><tt><font size=2>+
if (!pd) {</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device,
"rereg with bad pd, pd=%p "</font></tt>
<br><tt><font size=2>+
"mr_rereg_mask=%x", pd, mr_rereg_mask);</font></tt>
<br><tt><font size=2>+
ret = -EINVAL;</font></tt>
<br><tt><font size=2>+
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>+
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if ((mr_rereg_mask
&</font></tt>
<br><tt><font size=2>@@ -439,12 +395,10 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(mr->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* check
other parameters */</font></tt>
<br><tt><font size=2> if (e_mr
== shca->maxmr) {</font></tt>
<br><tt><font size=2>
/* should be impossible, however reject to
be sure */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(3, "rereg internal max-MR impossible,
mr=%p "</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "rereg internal max-MR
impossible, mr=%p "</font></tt>
<br><tt><font size=2>
"shca->maxmr=%p
mr->lkey=%x",</font></tt>
<br><tt><font size=2>
mr, shca->maxmr,
mr->lkey);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>@@ -452,14 +406,14 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (mr_rereg_mask
& IB_MR_REREG_TRANS) { /* transl., i.e. addr/size */</font></tt>
<br><tt><font size=2>
if (e_mr->flags & EHCA_MR_FLAG_FMR)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "not
supported for FMR, mr=%p flags=%x",</font></tt>
<br><tt><font size=2>-
mr, e_mr->flags);</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device,
"not supported for FMR, mr=%p "</font></tt>
<br><tt><font size=2>+
"flags=%x", mr, e_mr->flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>-
if (ehca_adr_bad(phys_buf_array) || num_phys_buf <=
0) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad
input values: mr_rereg_mask=%x "</font></tt>
<br><tt><font size=2>-
"phys_buf_array=%p num_phys_buf=%x",</font></tt>
<br><tt><font size=2>+
if (!phys_buf_array || num_phys_buf <= 0) {</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device,
"bad input values: mr_rereg_mask=%x"</font></tt>
<br><tt><font size=2>+
" phys_buf_array=%p num_phys_buf=%x",</font></tt>
<br><tt><font size=2>
mr_rereg_mask, phys_buf_array, num_phys_buf);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>@@ -474,7 +428,7 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2>
* Remote Write Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
* Remote Atomic Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: mr_rereg_mask=%x
"</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "bad input values: mr_rereg_mask=%x
"</font></tt>
<br><tt><font size=2>
"mr_access_flags=%x",
mr_rereg_mask, mr_access_flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit0;</font></tt>
<br><tt><font size=2>@@ -497,7 +451,7 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit1;</font></tt>
<br><tt><font size=2>
if ((new_size == 0) ||</font></tt>
<br><tt><font size=2>
(((u64)iova_start + new_size)
< (u64)iova_start)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad
input values: new_size=%lx "</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device,
"bad input values: new_size=%lx "</font></tt>
<br><tt><font size=2>
"iova_start=%p", new_size, iova_start);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto rereg_phys_mr_exit1;</font></tt>
<br><tt><font size=2>@@ -519,10 +473,6 @@ int ehca_rereg_phys_mr(struct
ib_mr *mr,</font></tt>
<br><tt><font size=2> if (mr_rereg_mask
& IB_MR_REREG_PD)</font></tt>
<br><tt><font size=2>
new_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "mr=%p
new_start=%p new_size=%lx new_acl=%x new_pd=%p "</font></tt>
<br><tt><font size=2>-
"num_pages_mr=%x num_pages_4k=%x", e_mr, new_start, new_size,</font></tt>
<br><tt><font size=2>-
new_acl, new_pd, num_pages_mr, num_pages_4k);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ret = ehca_rereg_mr(shca,
e_mr, new_start, new_size, new_acl,</font></tt>
<br><tt><font size=2>
new_pd, &pginfo, &tmp_lkey, &tmp_rkey);</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>@@ -538,17 +488,11 @@ rereg_phys_mr_exit1:</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&e_mr->mrlock,
sl_flags);</font></tt>
<br><tt><font size=2> rereg_phys_mr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x mr=%p mr_rereg_mask=%x pd=%p
"</font></tt>
<br><tt><font size=2>-
"phys_buf_array=%p
num_phys_buf=%x mr_access_flags=%x "</font></tt>
<br><tt><font size=2>-
"iova_start=%p",</font></tt>
<br><tt><font size=2>-
ret, mr, mr_rereg_mask,
pd, phys_buf_array,</font></tt>
<br><tt><font size=2>-
num_phys_buf,
mr_access_flags, iova_start);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "mr=%p mr_rereg_mask=%x pd=%p phys_buf_array=%p
"</font></tt>
<br><tt><font size=2>-
"num_phys_buf=%x
mr_access_flags=%x iova_start=%p",</font></tt>
<br><tt><font size=2>-
mr, mr_rereg_mask,
pd, phys_buf_array, num_phys_buf,</font></tt>
<br><tt><font size=2>-
mr_access_flags,
iova_start);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "ret=%x mr=%p mr_rereg_mask=%x
pd=%p "</font></tt>
<br><tt><font size=2>+
"phys_buf_array=%p
num_phys_buf=%x mr_access_flags=%x "</font></tt>
<br><tt><font size=2>+
"iova_start=%p",</font></tt>
<br><tt><font size=2>+
ret, mr, mr_rereg_mask,
pd, phys_buf_array,</font></tt>
<br><tt><font size=2>+
num_phys_buf,
mr_access_flags, iova_start);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_rereg_phys_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -557,47 +501,36 @@ rereg_phys_mr_exit0:</font></tt>
<br><tt><font size=2> int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr
*mr_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_mr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(mr->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_mr = container_of(mr, struct ehca_mr, ib.ib_mr);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> unsigned
long sl_flags;</font></tt>
<br><tt><font size=2> struct ehca_mr_hipzout_parms
hipzout = {{0},0,0,0,0,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "mr=%p
mr_attr=%p", mr, mr_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_MR(mr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_pd = container_of(mr->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
(my_pd->ownpid != cur_pid)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto query_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_mr = container_of(mr,
struct ehca_mr, ib.ib_mr);</font></tt>
<br><tt><font size=2>- if (ehca_adr_bad(mr_attr))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: mr_attr=%p",
mr_attr);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto query_mr_exit0;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2> if ((e_mr->flags
& EHCA_MR_FLAG_FMR)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "not supported for FMR, mr=%p e_mr=%p
"</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "not supported for FMR,
mr=%p e_mr=%p "</font></tt>
<br><tt><font size=2>
"e_mr->flags=%x",
mr, e_mr, e_mr->flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto query_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(mr->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> memset(mr_attr,
0, sizeof(struct ib_mr_attr));</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&e_mr->mrlock,
sl_flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_query_mr(shca->ipz_hca_handle, e_mr, &hipzout);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_mr_query failed, h_ret=%lx
mr=%p "</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "hipz_mr_query failed,
h_ret=%lx mr=%p "</font></tt>
<br><tt><font size=2>
"hca_hndl=%lx
mr_hndl=%lx lkey=%x",</font></tt>
<br><tt><font size=2>
h_ret,
mr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ipz_mr_handle.handle,
mr->lkey);</font></tt>
<br><tt><font size=2>@@ -615,13 +548,8 @@ query_mr_exit1:</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&e_mr->mrlock,
sl_flags);</font></tt>
<br><tt><font size=2> query_mr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x mr=%p mr_attr=%p", ret,
mr, mr_attr);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "pd=%p device_virt_addr=%lx size=%lx
"</font></tt>
<br><tt><font size=2>-
"mr_access_flags=%x
lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
mr_attr->pd,
mr_attr->device_virt_addr,</font></tt>
<br><tt><font size=2>-
mr_attr->size,
mr_attr->mr_access_flags,</font></tt>
<br><tt><font size=2>-
mr_attr->lkey,
mr_attr->rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "ret=%x mr=%p mr_attr=%p",</font></tt>
<br><tt><font size=2>+
ret, mr, mr_attr);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_query_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -630,35 +558,29 @@ query_mr_exit0:</font></tt>
<br><tt><font size=2> int ehca_dereg_mr(struct ib_mr *mr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_mr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(mr->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_mr = container_of(mr, struct ehca_mr, ib.ib_mr);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "mr=%p",
mr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_MR(mr);</font></tt>
<br><tt><font size=2>- my_pd = container_of(mr->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
(my_pd->ownpid != cur_pid)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto dereg_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_mr = container_of(mr,
struct ehca_mr, ib.ib_mr);</font></tt>
<br><tt><font size=2>- shca = container_of(mr->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if ((e_mr->flags
& EHCA_MR_FLAG_FMR)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "not supported for FMR, mr=%p e_mr=%p
"</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "not supported for FMR,
mr=%p e_mr=%p "</font></tt>
<br><tt><font size=2>
"e_mr->flags=%x",
mr, e_mr, e_mr->flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto dereg_mr_exit0;</font></tt>
<br><tt><font size=2> } else if
(e_mr == shca->maxmr) {</font></tt>
<br><tt><font size=2>
/* should be impossible, however reject to
be sure */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(3, "dereg internal max-MR impossible,
mr=%p "</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "dereg internal max-MR
impossible, mr=%p "</font></tt>
<br><tt><font size=2>
"shca->maxmr=%p
mr->lkey=%x",</font></tt>
<br><tt><font size=2>
mr, shca->maxmr,
mr->lkey);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>@@ -668,8 +590,8 @@ int ehca_dereg_mr(struct ib_mr
*mr)</font></tt>
<br><tt><font size=2> /* TODO:
BUSY: MR still has bound window(s) */</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_free_resource_mr(shca->ipz_hca_handle, e_mr);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_free_mr failed, h_ret=%lx shca=%p
e_mr=%p"</font></tt>
<br><tt><font size=2>-
" hca_hndl=%lx
mr_hndl=%lx mr->lkey=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "hipz_free_mr failed,
h_ret=%lx shca=%p "</font></tt>
<br><tt><font size=2>+
"e_mr=%p
hca_hndl=%lx mr_hndl=%lx mr->lkey=%x",</font></tt>
<br><tt><font size=2>
h_ret,
shca, e_mr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ipz_mr_handle.handle,
mr->lkey);</font></tt>
<br><tt><font size=2>
ret = ehca_mrmw_map_hrc_free_mr(h_ret);</font></tt>
<br><tt><font size=2>@@ -681,9 +603,7 @@ int ehca_dereg_mr(struct ib_mr
*mr)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> dereg_mr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x mr=%p", ret, mr);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>+
ehca_err(mr->device, "ret=%x mr=%p",
ret, mr);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_dereg_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -691,19 +611,14 @@ dereg_mr_exit0:</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> struct ib_mw *ehca_alloc_mw(struct ib_pd *pd)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ib_mw
*ib_mw = NULL;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mw
*e_mw = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ib_mw
*ib_mw;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ struct ehca_mw
*e_mw;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(pd->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> struct ehca_mw_hipzout_parms
hipzout = {{0},0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p",
pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- e_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> e_mw = ehca_mw_new();</font></tt>
<br><tt><font size=2> if (!e_mw)
{</font></tt>
<br><tt><font size=2>
ib_mw = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>@@ -713,25 +628,22 @@ struct ib_mw *ehca_alloc_mw(struct
ib_pd</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_alloc_resource_mw(shca->ipz_hca_handle, e_mw,</font></tt>
<br><tt><font size=2>
e_pd->fw_pd,
&hipzout);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_mw_allocate failed, h_ret=%lx
shca=%p "</font></tt>
<br><tt><font size=2>-
"hca_hndl=%lx
mw=%p", h_ret, shca,</font></tt>
<br><tt><font size=2>-
shca->ipz_hca_handle.handle,
e_mw);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "hipz_mw_allocate failed,
h_ret=%lx "</font></tt>
<br><tt><font size=2>+
"shca=%p
hca_hndl=%lx mw=%p",</font></tt>
<br><tt><font size=2>+
h_ret, shca,
shca->ipz_hca_handle.handle, e_mw);</font></tt>
<br><tt><font size=2>
ib_mw = ERR_PTR(ehca_mrmw_map_hrc_alloc(h_ret));</font></tt>
<br><tt><font size=2>
goto alloc_mw_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> /* successful
MW allocation */</font></tt>
<br><tt><font size=2> e_mw->ipz_mw_handle
= hipzout.handle;</font></tt>
<br><tt><font size=2> e_mw->ib_mw.rkey
= hipzout.rkey;</font></tt>
<br><tt><font size=2>- ib_mw = &e_mw->ib_mw;</font></tt>
<br><tt><font size=2>- goto alloc_mw_exit0;</font></tt>
<br><tt><font size=2>+ return &e_mw->ib_mw;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> alloc_mw_exit1:</font></tt>
<br><tt><font size=2> ehca_mw_delete(e_mw);</font></tt>
<br><tt><font size=2> alloc_mw_exit0:</font></tt>
<br><tt><font size=2> if (IS_ERR(ib_mw))</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "rc=%lx pd=%p", PTR_ERR(ib_mw),
pd);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ib_mw=%p rkey=%x", ib_mw, ib_mw->rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "rc=%lx pd=%p",
PTR_ERR(ib_mw), pd);</font></tt>
<br><tt><font size=2> return ib_mw;</font></tt>
<br><tt><font size=2> } /* end ehca_alloc_mw() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -741,55 +653,32 @@ int ehca_bind_mw(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
struct ib_mw *mw,</font></tt>
<br><tt><font size=2>
struct ib_mw_bind *mw_bind)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* TODO:
not supported up to now */</font></tt>
<br><tt><font size=2>- EDEB_ERR(4, "bind
MW currently not supported by HCAD");</font></tt>
<br><tt><font size=2>- ret = -EPERM;</font></tt>
<br><tt><font size=2>- goto bind_mw_exit0;</font></tt>
<br><tt><font size=2>+ ehca_gen_err("bind
MW currently not supported by HCAD");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-bind_mw_exit0:</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x qp=%p mw=%p mw_bind=%p",</font></tt>
<br><tt><font size=2>-
ret, qp, mw, mw_bind);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "qp=%p mw=%p mw_bind=%p", qp,
mw, mw_bind);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return -EPERM;</font></tt>
<br><tt><font size=2> } /* end ehca_bind_mw() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /*----------------------------------------------------------------------*/</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_dealloc_mw(struct ib_mw *mw)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mw
*e_mw = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "mw=%p",
mw);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_MW(mw);</font></tt>
<br><tt><font size=2>- e_mw = container_of(mw,
struct ehca_mw, ib_mw);</font></tt>
<br><tt><font size=2>- shca = container_of(mw->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(mw->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_mw
*e_mw = container_of(mw, struct ehca_mw, ib_mw);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_free_resource_mw(shca->ipz_hca_handle, e_mw);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_free_mw failed, h_ret=%lx shca=%p
mw=%p "</font></tt>
<br><tt><font size=2>-
"rkey=%x
hca_hndl=%lx mw_hndl=%lx",</font></tt>
<br><tt><font size=2>+
ehca_err(mw->device, "hipz_free_mw failed,
h_ret=%lx shca=%p "</font></tt>
<br><tt><font size=2>+
"mw=%p rkey=%x
hca_hndl=%lx mw_hndl=%lx",</font></tt>
<br><tt><font size=2>
h_ret,
shca, mw, mw->rkey, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_mw->ipz_mw_handle.handle);</font></tt>
<br><tt><font size=2>-
ret = ehca_mrmw_map_hrc_free_mw(h_ret);</font></tt>
<br><tt><font size=2>-
goto dealloc_mw_exit0;</font></tt>
<br><tt><font size=2>+
return ehca_mrmw_map_hrc_free_mw(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> /* successful
deallocation */</font></tt>
<br><tt><font size=2> ehca_mw_delete(e_mw);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-dealloc_mw_exit0:</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x mw=%p", ret, mw);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> } /* end ehca_dealloc_mw() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /*----------------------------------------------------------------------*/</font></tt>
<br><tt><font size=2>@@ -798,28 +687,15 @@ struct ib_fmr *ehca_alloc_fmr(struct
ib_</font></tt>
<br><tt><font size=2>
int mr_access_flags,</font></tt>
<br><tt><font size=2>
struct ib_fmr_attr *fmr_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ib_fmr
*ib_fmr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_fmr = NULL;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>- u32 tmp_lkey
= 0;</font></tt>
<br><tt><font size=2>- u32 tmp_rkey
= 0;</font></tt>
<br><tt><font size=2>+ struct ib_fmr
*ib_fmr;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(pd->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_fmr;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ u32 tmp_lkey,
tmp_rkey;</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p
mr_access_flags=%x fmr_attr=%p",</font></tt>
<br><tt><font size=2>-
pd, mr_access_flags, fmr_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- if (ehca_adr_bad(fmr_attr))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: fmr_attr=%p",
fmr_attr);</font></tt>
<br><tt><font size=2>-
ib_fmr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>-
goto alloc_fmr_exit0;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB(7, "max_pages=%x
max_maps=%x page_shift=%x",</font></tt>
<br><tt><font size=2>-
fmr_attr->max_pages, fmr_attr->max_maps, fmr_attr->page_shift);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* check
other parameters */</font></tt>
<br><tt><font size=2> if (((mr_access_flags
& IB_ACCESS_REMOTE_WRITE) &&</font></tt>
<br><tt><font size=2>
!(mr_access_flags & IB_ACCESS_LOCAL_WRITE)) ||</font></tt>
<br><tt><font size=2>@@ -829,19 +705,19 @@ struct ib_fmr *ehca_alloc_fmr(struct
ib_</font></tt>
<br><tt><font size=2>
* Remote Write Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
* Remote Atomic Access requires Local Write
Access</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>
mr_access_flags);</font></tt>
<br><tt><font size=2>
ib_fmr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto alloc_fmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (mr_access_flags
& IB_ACCESS_MW_BIND) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: mr_access_flags=%x",</font></tt>
<br><tt><font size=2>
mr_access_flags);</font></tt>
<br><tt><font size=2>
ib_fmr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto alloc_fmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if ((fmr_attr->max_pages
== 0) || (fmr_attr->max_maps == 0)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: fmr_attr->max_pages=%x
"</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "bad input values: fmr_attr->max_pages=%x
"</font></tt>
<br><tt><font size=2>
"fmr_attr->max_maps=%x
fmr_attr->page_shift=%x",</font></tt>
<br><tt><font size=2>
fmr_attr->max_pages,
fmr_attr->max_maps,</font></tt>
<br><tt><font size=2>
fmr_attr->page_shift);</font></tt>
<br><tt><font size=2>@@ -850,15 +726,12 @@ struct ib_fmr *ehca_alloc_fmr(struct
ib_</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (((1
<< fmr_attr->page_shift) != EHCA_PAGESIZE) &&</font></tt>
<br><tt><font size=2>
((1 << fmr_attr->page_shift) != PAGE_SIZE)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "unsupported fmr_attr->page_shift=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "unsupported fmr_attr->page_shift=%x",</font></tt>
<br><tt><font size=2>
fmr_attr->page_shift);</font></tt>
<br><tt><font size=2>
ib_fmr = ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>
goto alloc_fmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> e_fmr =
ehca_mr_new();</font></tt>
<br><tt><font size=2> if (!e_fmr)
{</font></tt>
<br><tt><font size=2>
ib_fmr = ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2>@@ -881,19 +754,15 @@ struct ib_fmr *ehca_alloc_fmr(struct
ib_</font></tt>
<br><tt><font size=2> e_fmr->fmr_max_pages
= fmr_attr->max_pages;</font></tt>
<br><tt><font size=2> e_fmr->fmr_max_maps
= fmr_attr->max_maps;</font></tt>
<br><tt><font size=2> e_fmr->fmr_map_cnt
= 0;</font></tt>
<br><tt><font size=2>- ib_fmr = &e_fmr->ib.ib_fmr;</font></tt>
<br><tt><font size=2>- goto alloc_fmr_exit0;</font></tt>
<br><tt><font size=2>+ return &e_fmr->ib.ib_fmr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> alloc_fmr_exit1:</font></tt>
<br><tt><font size=2> ehca_mr_delete(e_fmr);</font></tt>
<br><tt><font size=2> alloc_fmr_exit0:</font></tt>
<br><tt><font size=2> if (IS_ERR(ib_fmr))</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "rc=%lx pd=%p mr_access_flags=%x "</font></tt>
<br><tt><font size=2>-
"fmr_attr=%p",
PTR_ERR(ib_fmr), pd,</font></tt>
<br><tt><font size=2>-
mr_access_flags,
fmr_attr);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ib_fmr=%p tmp_lkey=%x tmp_rkey=%x",</font></tt>
<br><tt><font size=2>-
ib_fmr, tmp_lkey,
tmp_rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "rc=%lx pd=%p mr_access_flags=%x
"</font></tt>
<br><tt><font size=2>+
"fmr_attr=%p",
PTR_ERR(ib_fmr), pd,</font></tt>
<br><tt><font size=2>+
mr_access_flags,
fmr_attr);</font></tt>
<br><tt><font size=2> return ib_fmr;</font></tt>
<br><tt><font size=2> } /* end ehca_alloc_fmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -904,24 +773,16 @@ int ehca_map_phys_fmr(struct
ib_fmr *fmr</font></tt>
<br><tt><font size=2>
int list_len,</font></tt>
<br><tt><font size=2>
u64 iova)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_fmr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(fmr->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_fmr = container_of(fmr, struct ehca_mr, ib.ib_fmr);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd = container_of(fmr->pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2>- u32 tmp_lkey
= 0;</font></tt>
<br><tt><font size=2>- u32 tmp_rkey
= 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "fmr=%p
page_list=%p list_len=%x iova=%lx",</font></tt>
<br><tt><font size=2>-
fmr, page_list, list_len, iova);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_FMR(fmr);</font></tt>
<br><tt><font size=2>- e_fmr = container_of(fmr,
struct ehca_mr, ib.ib_fmr);</font></tt>
<br><tt><font size=2>- shca = container_of(fmr->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>- e_pd = container_of(fmr->pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+ u32 tmp_lkey,
tmp_rkey;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (!(e_fmr->flags
& EHCA_MR_FLAG_FMR)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "not a FMR, e_fmr=%p e_fmr->flags=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(fmr->device, "not a FMR, e_fmr=%p
e_fmr->flags=%x",</font></tt>
<br><tt><font size=2>
e_fmr,
e_fmr->flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto map_phys_fmr_exit0;</font></tt>
<br><tt><font size=2>@@ -931,16 +792,16 @@ int ehca_map_phys_fmr(struct
ib_fmr *fmr</font></tt>
<br><tt><font size=2>
goto map_phys_fmr_exit0;</font></tt>
<br><tt><font size=2> if (iova
% e_fmr->fmr_page_size) {</font></tt>
<br><tt><font size=2>
/* only whole-numbered pages */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad iova, iova=%lx fmr_page_size=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(fmr->device, "bad iova, iova=%lx
fmr_page_size=%x",</font></tt>
<br><tt><font size=2>
iova,
e_fmr->fmr_page_size);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto map_phys_fmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (e_fmr->fmr_map_cnt
>= e_fmr->fmr_max_maps) {</font></tt>
<br><tt><font size=2>
/* HCAD does not limit the maps, however trace
this anyway */</font></tt>
<br><tt><font size=2>-
EDEB(6, "map limit exceeded, fmr=%p e_fmr->fmr_map_cnt=%x
"</font></tt>
<br><tt><font size=2>-
"e_fmr->fmr_max_maps=%x",</font></tt>
<br><tt><font size=2>-
fmr, e_fmr->fmr_map_cnt, e_fmr->fmr_max_maps);</font></tt>
<br><tt><font size=2>+
ehca_info(fmr->device, "map limit exceeded,
fmr=%p "</font></tt>
<br><tt><font size=2>+
"e_fmr->fmr_map_cnt=%x
e_fmr->fmr_max_maps=%x",</font></tt>
<br><tt><font size=2>+
fmr, e_fmr->fmr_map_cnt,
e_fmr->fmr_max_maps);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> pginfo.type
= EHCA_MR_PGI_FMR;</font></tt>
<br><tt><font size=2>@@ -960,14 +821,13 @@ int ehca_map_phys_fmr(struct
ib_fmr *fmr</font></tt>
<br><tt><font size=2> e_fmr->fmr_map_cnt++;</font></tt>
<br><tt><font size=2> e_fmr->ib.ib_fmr.lkey
= tmp_lkey;</font></tt>
<br><tt><font size=2> e_fmr->ib.ib_fmr.rkey
= tmp_rkey;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> map_phys_fmr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x fmr=%p page_list=%p list_len=%x
iova=%lx",</font></tt>
<br><tt><font size=2>-
ret, fmr, page_list,
list_len, iova);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
e_fmr->ib.ib_fmr.lkey,
e_fmr->ib.ib_fmr.rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(fmr->device, "ret=%x fmr=%p page_list=%p
list_len=%x "</font></tt>
<br><tt><font size=2>+
"iova=%lx",</font></tt>
<br><tt><font size=2>+
ret, fmr, page_list,
list_len, iova);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_map_phys_fmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -976,31 +836,34 @@ map_phys_fmr_exit0:</font></tt>
<br><tt><font size=2> int ehca_unmap_fmr(struct list_head *fmr_list)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ib_fmr
*ib_fmr = NULL;</font></tt>
<br><tt><font size=2>+ struct ib_fmr
*ib_fmr;</font></tt>
<br><tt><font size=2> struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*prev_shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_fmr = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*prev_shca;</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_fmr;</font></tt>
<br><tt><font size=2> u32 num_fmr
= 0;</font></tt>
<br><tt><font size=2> u32 unmap_fmr_cnt
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "fmr_list=%p",
fmr_list);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* check
all FMR belong to same SHCA, and check internal flag */</font></tt>
<br><tt><font size=2> list_for_each_entry(ib_fmr,
fmr_list, list) {</font></tt>
<br><tt><font size=2>
prev_shca = shca;</font></tt>
<br><tt><font size=2>+
if (!ib_fmr) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad
fmr=%p in list", ib_fmr);</font></tt>
<br><tt><font size=2>+
ret = -EINVAL;</font></tt>
<br><tt><font size=2>+
goto unmap_fmr_exit0;</font></tt>
<br><tt><font size=2>+
}</font></tt>
<br><tt><font size=2>
shca = container_of(ib_fmr->device, struct
ehca_shca,</font></tt>
<br><tt><font size=2>
ib_device);</font></tt>
<br><tt><font size=2>-
EHCA_CHECK_FMR(ib_fmr);</font></tt>
<br><tt><font size=2>
e_fmr = container_of(ib_fmr, struct ehca_mr,
ib.ib_fmr);</font></tt>
<br><tt><font size=2>
if ((shca != prev_shca) && prev_shca)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "SHCA
mismatch, shca=%p prev_shca=%p "</font></tt>
<br><tt><font size=2>-
"e_fmr=%p", shca, prev_shca, e_fmr);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"SHCA mismatch, shca=%p "</font></tt>
<br><tt><font size=2>+
"prev_shca=%p e_fmr=%p",</font></tt>
<br><tt><font size=2>+
shca, prev_shca, e_fmr);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto unmap_fmr_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
if (!(e_fmr->flags & EHCA_MR_FLAG_FMR))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "not
a FMR, e_fmr=%p e_fmr->flags=%x",</font></tt>
<br><tt><font size=2>-
e_fmr, e_fmr->flags);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"not a FMR, e_fmr=%p "</font></tt>
<br><tt><font size=2>+
"e_fmr->flags=%x", e_fmr, e_fmr->flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto unmap_fmr_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -1016,20 +879,18 @@ int ehca_unmap_fmr(struct list_head
*fmr</font></tt>
<br><tt><font size=2>
ret = ehca_unmap_one_fmr(shca, e_fmr);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>
/* unmap
failed, stop unmapping of rest of FMRs */</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "unmap
of one FMR failed, stop rest, "</font></tt>
<br><tt><font size=2>-
"e_fmr=%p num_fmr=%x unmap_fmr_cnt=%x lkey=%x",</font></tt>
<br><tt><font size=2>-
e_fmr, num_fmr, unmap_fmr_cnt,</font></tt>
<br><tt><font size=2>-
e_fmr->ib.ib_fmr.lkey);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"unmap of one FMR failed, "</font></tt>
<br><tt><font size=2>+
"stop rest, e_fmr=%p num_fmr=%x "</font></tt>
<br><tt><font size=2>+
"unmap_fmr_cnt=%x lkey=%x", e_fmr, num_fmr,</font></tt>
<br><tt><font size=2>+
unmap_fmr_cnt, e_fmr->ib.ib_fmr.lkey);</font></tt>
<br><tt><font size=2>
goto unmap_fmr_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> unmap_fmr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x fmr_list=%p num_fmr=%x unmap_fmr_cnt=%x",</font></tt>
<br><tt><font size=2>-
ret, fmr_list,
num_fmr, unmap_fmr_cnt);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "num_fmr=%x", num_fmr);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("ret=%x fmr_list=%p num_fmr=%x unmap_fmr_cnt=%x",</font></tt>
<br><tt><font size=2>+
ret, fmr_list, num_fmr, unmap_fmr_cnt);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_unmap_fmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1037,19 +898,14 @@ unmap_fmr_exit0:</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_dealloc_fmr(struct ib_fmr *fmr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_fmr = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "fmr=%p",
fmr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_FMR(fmr);</font></tt>
<br><tt><font size=2>- e_fmr = container_of(fmr,
struct ehca_mr, ib.ib_fmr);</font></tt>
<br><tt><font size=2>- shca = container_of(fmr->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(fmr->device, struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_fmr = container_of(fmr, struct ehca_mr, ib.ib_fmr);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (!(e_fmr->flags
& EHCA_MR_FLAG_FMR)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "not a FMR, e_fmr=%p e_fmr->flags=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(fmr->device, "not a FMR, e_fmr=%p
e_fmr->flags=%x",</font></tt>
<br><tt><font size=2>
e_fmr,
e_fmr->flags);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto free_fmr_exit0;</font></tt>
<br><tt><font size=2>@@ -1057,21 +913,20 @@ int ehca_dealloc_fmr(struct
ib_fmr *fmr)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_free_resource_mr(shca->ipz_hca_handle, e_fmr);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_free_mr failed, h_ret=%lx e_fmr=%p
"</font></tt>
<br><tt><font size=2>+
ehca_err(fmr->device, "hipz_free_mr failed,
h_ret=%lx e_fmr=%p "</font></tt>
<br><tt><font size=2>
"hca_hndl=%lx
fmr_hndl=%lx fmr->lkey=%x",</font></tt>
<br><tt><font size=2>
h_ret,
e_fmr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_fmr->ipz_mr_handle.handle,
fmr->lkey);</font></tt>
<br><tt><font size=2>-
ehca_mrmw_map_hrc_free_mr(h_ret);</font></tt>
<br><tt><font size=2>+
ret = ehca_mrmw_map_hrc_free_mr(h_ret);</font></tt>
<br><tt><font size=2>
goto free_fmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> /* successful
deregistration */</font></tt>
<br><tt><font size=2> ehca_mr_delete(e_fmr);</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> free_fmr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x fmr=%p", ret, fmr);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x fmr=%p",
ret, fmr);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_dealloc_fmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1087,15 +942,11 @@ int ehca_reg_mr(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2>
u32 *lkey, /*OUT*/</font></tt>
<br><tt><font size=2>
u32 *rkey) /*OUT*/</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u32 hipz_acl
= 0;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ u32 hipz_acl;</font></tt>
<br><tt><font size=2> struct ehca_mr_hipzout_parms
hipzout = {{0},0,0,0,0,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
e_mr=%p iova_start=%p size=%lx acl=%x e_pd=%p "</font></tt>
<br><tt><font size=2>-
"pginfo=%p num_pages=%lx num_4k=%lx", shca,
e_mr, iova_start,</font></tt>
<br><tt><font size=2>-
size, acl, e_pd, pginfo, pginfo->num_pages, pginfo->num_4k);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ehca_mrmw_map_acl(acl,
&hipz_acl);</font></tt>
<br><tt><font size=2> ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);</font></tt>
<br><tt><font size=2> if (ehca_use_hp_mr
== 1)</font></tt>
<br><tt><font size=2>@@ -1105,8 +956,8 @@ int ehca_reg_mr(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2>
(u64)iova_start,
size, hipz_acl,</font></tt>
<br><tt><font size=2>
e_pd->fw_pd,
&hipzout);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_alloc_mr failed, h_ret=%lx
hca_hndl=%lx",</font></tt>
<br><tt><font size=2>-
h_ret, shca->ipz_hca_handle.handle);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "hipz_alloc_mr
failed, h_ret=%lx "</font></tt>
<br><tt><font size=2>+
"hca_hndl=%lx",
h_ret, shca->ipz_hca_handle.handle);</font></tt>
<br><tt><font size=2>
ret = ehca_mrmw_map_hrc_alloc(h_ret);</font></tt>
<br><tt><font size=2>
goto ehca_reg_mr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1125,26 +976,27 @@ int ehca_reg_mr(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2> e_mr->acl
= acl;</font></tt>
<br><tt><font size=2> *lkey =
hipzout.lkey;</font></tt>
<br><tt><font size=2> *rkey =
hipzout.rkey;</font></tt>
<br><tt><font size=2>- goto ehca_reg_mr_exit0;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_reg_mr_exit1:</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_free_resource_mr(shca->ipz_hca_handle, e_mr);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(1, "h_ret=%lx shca=%p e_mr=%p iova_start=%p
"</font></tt>
<br><tt><font size=2>-
"size=%lx
acl=%x e_pd=%p lkey=%x pginfo=%p "</font></tt>
<br><tt><font size=2>-
"num_pages=%lx
num_4k=%lx ret=%x", h_ret, shca, e_mr,</font></tt>
<br><tt><font size=2>-
iova_start, size,
acl, e_pd, hipzout.lkey, pginfo,</font></tt>
<br><tt><font size=2>-
pginfo->num_pages,
pginfo->num_4k, ret);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(1, "internal error in ehca_reg_mr, not
recoverable");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "h_ret=%lx
shca=%p e_mr=%p "</font></tt>
<br><tt><font size=2>+
"iova_start=%p
size=%lx acl=%x e_pd=%p lkey=%x "</font></tt>
<br><tt><font size=2>+
"pginfo=%p
num_pages=%lx num_4k=%lx ret=%x",</font></tt>
<br><tt><font size=2>+
h_ret, shca,
e_mr, iova_start, size, acl, e_pd,</font></tt>
<br><tt><font size=2>+
hipzout.lkey,
pginfo, pginfo->num_pages,</font></tt>
<br><tt><font size=2>+
pginfo->num_4k,
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "internal error
in ehca_reg_mr, "</font></tt>
<br><tt><font size=2>+
"not recoverable");</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> ehca_reg_mr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x shca=%p e_mr=%p iova_start=%p
size=%lx "</font></tt>
<br><tt><font size=2>-
"acl=%x e_pd=%p
pginfo=%p num_pages=%lx num_4k=%lx",</font></tt>
<br><tt><font size=2>-
ret, shca, e_mr,
iova_start, size, acl, e_pd, pginfo,</font></tt>
<br><tt><font size=2>-
pginfo->num_pages,
pginfo->num_4k);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x lkey=%x rkey=%x", ret,
*lkey, *rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x shca=%p
e_mr=%p "</font></tt>
<br><tt><font size=2>+
"iova_start=%p
size=%lx acl=%x e_pd=%p pginfo=%p "</font></tt>
<br><tt><font size=2>+
"num_pages=%lx
num_4k=%lx",</font></tt>
<br><tt><font size=2>+
ret, shca, e_mr,
iova_start, size, acl, e_pd, pginfo,</font></tt>
<br><tt><font size=2>+
pginfo->num_pages,
pginfo->num_4k);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1155,18 +1007,15 @@ int ehca_reg_mr_rpages(struct
ehca_shca </font></tt>
<br><tt><font size=2>
struct ehca_mr_pginfo
*pginfo)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u32 rnum = 0;</font></tt>
<br><tt><font size=2>- u64 rpage = 0;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ u32 rnum;</font></tt>
<br><tt><font size=2>+ u64 rpage;</font></tt>
<br><tt><font size=2> u32 i;</font></tt>
<br><tt><font size=2>- u64 *kpage =
NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
e_mr=%p pginfo=%p num_pages=%lx num_4k=%lx",</font></tt>
<br><tt><font size=2>-
shca, e_mr, pginfo, pginfo->num_pages, pginfo->num_4k);</font></tt>
<br><tt><font size=2>+ u64 *kpage;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> kpage =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!kpage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "kpage alloc failed");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "kpage alloc
failed");</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>
goto ehca_reg_mr_rpages_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1184,29 +1033,29 @@ int ehca_reg_mr_rpages(struct
ehca_shca </font></tt>
<br><tt><font size=2>
if (rnum > 1) {</font></tt>
<br><tt><font size=2>
ret = ehca_set_pagebuf(e_mr,
pginfo, rnum, kpage);</font></tt>
<br><tt><font size=2>
if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "ehca_set_pagebuf bad rc, ret=%x
"</font></tt>
<br><tt><font size=2>-
"rnum=%x
kpage=%p", ret, rnum, kpage);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ehca_set_pagebuf
"</font></tt>
<br><tt><font size=2>+
"bad rc,
ret=%x rnum=%x kpage=%p",</font></tt>
<br><tt><font size=2>+
ret, rnum, kpage);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_reg_mr_rpages_exit1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
rpage =
virt_to_abs(kpage);</font></tt>
<br><tt><font size=2>
if (!rpage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "kpage=%p i=%x", kpage, i);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "kpage=%p i=%x",</font></tt>
<br><tt><font size=2>+
kpage, i);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_reg_mr_rpages_exit1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
} else { /* rnum==1 */</font></tt>
<br><tt><font size=2>
ret = ehca_set_pagebuf_1(e_mr,
pginfo, &rpage);</font></tt>
<br><tt><font size=2>
if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "ehca_set_pagebuf_1 bad rc, "</font></tt>
<br><tt><font size=2>-
"ret=%x
i=%x", ret, i);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ehca_set_pagebuf_1
"</font></tt>
<br><tt><font size=2>+
"bad rc,
ret=%x i=%x", ret, i);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_reg_mr_rpages_exit1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(9, "i=%x rnum=%x rpage=%lx", i, rnum,
rpage);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>
h_ret = hipz_h_register_rpage_mr(shca->ipz_hca_handle,
e_mr,</font></tt>
<br><tt><font size=2>
0, /* pagesize 4k */</font></tt>
<br><tt><font size=2>
0, rpage, rnum);</font></tt>
<br><tt><font size=2>@@ -1217,9 +1066,10 @@ int ehca_reg_mr_rpages(struct
ehca_shca </font></tt>
<br><tt><font size=2>
* and
for 'page registered'==H_PAGE_REGISTERED</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>
if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "last hipz_reg_rpage_mr failed, "</font></tt>
<br><tt><font size=2>-
"h_ret=%lx
e_mr=%p i=%x hca_hndl=%lx "</font></tt>
<br><tt><font size=2>-
"mr_hndl=%lx
lkey=%x", h_ret, e_mr, i,</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "last "</font></tt>
<br><tt><font size=2>+
"hipz_reg_rpage_mr
failed, h_ret=%lx "</font></tt>
<br><tt><font size=2>+
"e_mr=%p
i=%x hca_hndl=%lx mr_hndl=%lx"</font></tt>
<br><tt><font size=2>+
" lkey=%x",
h_ret, e_mr, i,</font></tt>
<br><tt><font size=2>
shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ib.ib_mr.lkey);</font></tt>
<br><tt><font size=2>@@ -1228,8 +1078,8 @@ int ehca_reg_mr_rpages(struct
ehca_shca </font></tt>
<br><tt><font size=2>
} else</font></tt>
<br><tt><font size=2>
ret = 0;</font></tt>
<br><tt><font size=2>
} else if (h_ret != H_PAGE_REGISTERED) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_reg_rpage_mr
failed, h_ret=%lx "</font></tt>
<br><tt><font size=2>-
"e_mr=%p i=%x lkey=%x hca_hndl=%lx "</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"hipz_reg_rpage_mr failed, "</font></tt>
<br><tt><font size=2>+
"h_ret=%lx e_mr=%p i=%x lkey=%x hca_hndl=%lx
"</font></tt>
<br><tt><font size=2>
"mr_hndl=%lx", h_ret, e_mr, i,</font></tt>
<br><tt><font size=2>
e_mr->ib.ib_mr.lkey,</font></tt>
<br><tt><font size=2>
shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>@@ -1245,11 +1095,9 @@ ehca_reg_mr_rpages_exit1:</font></tt>
<br><tt><font size=2> kfree(kpage);</font></tt>
<br><tt><font size=2> ehca_reg_mr_rpages_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x shca=%p e_mr=%p pginfo=%p
num_pages=%lx "</font></tt>
<br><tt><font size=2>-
"num_4k=%lx",
ret, shca, e_mr, pginfo,</font></tt>
<br><tt><font size=2>-
pginfo->num_pages,
pginfo->num_4k);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x", ret);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x shca=%p
e_mr=%p pginfo=%p "</font></tt>
<br><tt><font size=2>+
"num_pages=%lx
num_4k=%lx", ret, shca, e_mr, pginfo,</font></tt>
<br><tt><font size=2>+
pginfo->num_pages,
pginfo->num_4k);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_mr_rpages() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1265,25 +1113,20 @@ inline int ehca_rereg_mr_rereg1(struct
e</font></tt>
<br><tt><font size=2>
u32 *lkey, /*OUT*/</font></tt>
<br><tt><font size=2>
u32 *rkey) /*OUT*/</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u32 hipz_acl
= 0;</font></tt>
<br><tt><font size=2>- u64 *kpage =
NULL;</font></tt>
<br><tt><font size=2>- u64 rpage = 0;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ u32 hipz_acl;</font></tt>
<br><tt><font size=2>+ u64 *kpage;</font></tt>
<br><tt><font size=2>+ u64 rpage;</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo_save;</font></tt>
<br><tt><font size=2> struct ehca_mr_hipzout_parms
hipzout = {{0},0,0,0,0,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
e_mr=%p iova_start=%p size=%lx acl=%x "</font></tt>
<br><tt><font size=2>-
"e_pd=%p pginfo=%p num_pages=%lx num_4k=%lx",
shca, e_mr,</font></tt>
<br><tt><font size=2>-
iova_start, size, acl, e_pd, pginfo, pginfo->num_pages,</font></tt>
<br><tt><font size=2>-
pginfo->num_4k);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ehca_mrmw_map_acl(acl,
&hipz_acl);</font></tt>
<br><tt><font size=2> ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> kpage =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!kpage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "kpage alloc failed");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "kpage alloc
failed");</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>
goto ehca_rereg_mr_rereg1_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1291,14 +1134,15 @@ inline int ehca_rereg_mr_rereg1(struct
e</font></tt>
<br><tt><font size=2> pginfo_save
= *pginfo;</font></tt>
<br><tt><font size=2> ret = ehca_set_pagebuf(e_mr,
pginfo, pginfo->num_4k, kpage);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "set pagebuf failed, e_mr=%p pginfo=%p
type=%x "</font></tt>
<br><tt><font size=2>-
"num_pages=%lx
num_4k=%lx kpage=%p", e_mr, pginfo,</font></tt>
<br><tt><font size=2>-
pginfo->type,
pginfo->num_pages, pginfo->num_4k,kpage);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "set pagebuf
failed, e_mr=%p "</font></tt>
<br><tt><font size=2>+
"pginfo=%p
type=%x num_pages=%lx num_4k=%lx kpage=%p",</font></tt>
<br><tt><font size=2>+
e_mr, pginfo,
pginfo->type, pginfo->num_pages,</font></tt>
<br><tt><font size=2>+
pginfo->num_4k,kpage);</font></tt>
<br><tt><font size=2>
goto ehca_rereg_mr_rereg1_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> rpage =
virt_to_abs(kpage);</font></tt>
<br><tt><font size=2> if (!rpage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "kpage=%p", kpage);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "kpage=%p",
kpage);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_rereg_mr_rereg1_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1311,13 +1155,13 @@ inline int ehca_rereg_mr_rereg1(struct
e</font></tt>
<br><tt><font size=2>
* e.g. this is required in case H_MR_CONDITION</font></tt>
<br><tt><font size=2>
* (MW bound or MR is shared)</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB(6, "hipz_h_reregister_pmr failed (Rereg1),
h_ret=%lx "</font></tt>
<br><tt><font size=2>-
"e_mr=%p", h_ret, e_mr);</font></tt>
<br><tt><font size=2>+
ehca_warn(&shca->ib_device, "hipz_h_reregister_pmr
failed "</font></tt>
<br><tt><font size=2>+
"(Rereg1),
h_ret=%lx e_mr=%p", h_ret, e_mr);</font></tt>
<br><tt><font size=2>
*pginfo = pginfo_save;</font></tt>
<br><tt><font size=2>
ret = -EAGAIN;</font></tt>
<br><tt><font size=2> } else if
((u64*)hipzout.vaddr != iova_start) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "PHYP changed iova_start in rereg_pmr,
"</font></tt>
<br><tt><font size=2>-
"iova_start=%p
iova_start_out=%lx e_mr=%p "</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "PHYP changed
iova_start in "</font></tt>
<br><tt><font size=2>+
"rereg_pmr,
iova_start=%p iova_start_out=%lx e_mr=%p "</font></tt>
<br><tt><font size=2>
"mr_handle=%lx
lkey=%x lkey_out=%x", iova_start,</font></tt>
<br><tt><font size=2>
hipzout.vaddr,
e_mr, e_mr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ib.ib_mr.lkey,
hipzout.lkey);</font></tt>
<br><tt><font size=2>@@ -1340,13 +1184,10 @@ ehca_rereg_mr_rereg1_exit1:</font></tt>
<br><tt><font size=2> kfree(kpage);</font></tt>
<br><tt><font size=2> ehca_rereg_mr_rereg1_exit0:</font></tt>
<br><tt><font size=2> if ( ret
&& (ret != -EAGAIN) )</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x h_ret=%lx lkey=%x rkey=%x
pginfo=%p "</font></tt>
<br><tt><font size=2>-
"num_pages=%lx
num_4k=%lx", ret, h_ret, *lkey, *rkey,</font></tt>
<br><tt><font size=2>-
pginfo, pginfo->num_pages,
pginfo->num_4k);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x h_ret=%lx lkey=%x rkey=%x
pginfo=%p "</font></tt>
<br><tt><font size=2>-
"num_pages=%lx
num_4k=%lx", ret, h_ret, *lkey, *rkey,</font></tt>
<br><tt><font size=2>-
pginfo, pginfo->num_pages,
pginfo->num_4k);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x lkey=%x
rkey=%x "</font></tt>
<br><tt><font size=2>+
"pginfo=%p
num_pages=%lx num_4k=%lx",</font></tt>
<br><tt><font size=2>+
ret, *lkey, *rkey,
pginfo, pginfo->num_pages,</font></tt>
<br><tt><font size=2>+
pginfo->num_4k);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_rereg_mr_rereg1() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1363,20 +1204,15 @@ int ehca_rereg_mr(struct ehca_shca
*shca</font></tt>
<br><tt><font size=2>
u32 *rkey)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> int rereg_1_hcall
= 1; /* 1: use hipz_h_reregister_pmr directly */</font></tt>
<br><tt><font size=2> int rereg_3_hcall
= 0; /* 1: use 3 hipz calls for reregistration */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
e_mr=%p iova_start=%p size=%lx acl=%x "</font></tt>
<br><tt><font size=2>-
"e_pd=%p pginfo=%p num_pages=%lx num_4k=%lx",
shca, e_mr,</font></tt>
<br><tt><font size=2>-
iova_start, size, acl, e_pd, pginfo, pginfo->num_pages,</font></tt>
<br><tt><font size=2>-
pginfo->num_4k);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* first
determine reregistration hCall(s) */</font></tt>
<br><tt><font size=2> if ((pginfo->num_4k
> 512) || (e_mr->num_4k > 512) ||</font></tt>
<br><tt><font size=2>
(pginfo->num_4k > e_mr->num_4k)) {</font></tt>
<br><tt><font size=2>-
EDEB(7, "Rereg3 case, pginfo->num_4k=%lx "</font></tt>
<br><tt><font size=2>-
"e_mr->num_4k=%x", pginfo->num_4k,
e_mr->num_4k);</font></tt>
<br><tt><font size=2>+
ehca_dbg(&shca->ib_device, "Rereg3 case,
pginfo->num_4k=%lx "</font></tt>
<br><tt><font size=2>+
"e_mr->num_4k=%x",
pginfo->num_4k, e_mr->num_4k);</font></tt>
<br><tt><font size=2>
rereg_1_hcall = 0;</font></tt>
<br><tt><font size=2>
rereg_3_hcall = 1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1385,7 +1221,8 @@ int ehca_rereg_mr(struct ehca_shca
*shca</font></tt>
<br><tt><font size=2>
rereg_1_hcall = 0;</font></tt>
<br><tt><font size=2>
rereg_3_hcall = 1;</font></tt>
<br><tt><font size=2>
e_mr->flags &= ~EHCA_MR_FLAG_MAXMR;</font></tt>
<br><tt><font size=2>-
EDEB(4, "Rereg MR for max-MR! e_mr=%p",
e_mr);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Rereg MR for
max-MR! e_mr=%p",</font></tt>
<br><tt><font size=2>+
e_mr);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (rereg_1_hcall)
{</font></tt>
<br><tt><font size=2>@@ -1405,8 +1242,9 @@ int ehca_rereg_mr(struct ehca_shca
*shca</font></tt>
<br><tt><font size=2>
/* first deregister old MR */</font></tt>
<br><tt><font size=2>
h_ret = hipz_h_free_resource_mr(shca->ipz_hca_handle,
e_mr);</font></tt>
<br><tt><font size=2>
if (h_ret != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_free_mr
failed, h_ret=%lx e_mr=%p "</font></tt>
<br><tt><font size=2>-
"hca_hndl=%lx mr_hndl=%lx mr->lkey=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"hipz_free_mr failed, "</font></tt>
<br><tt><font size=2>+
"h_ret=%lx e_mr=%p hca_hndl=%lx mr_hndl=%lx
"</font></tt>
<br><tt><font size=2>+
"mr->lkey=%x",</font></tt>
<br><tt><font size=2>
h_ret, e_mr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_mr->ib.ib_mr.lkey);</font></tt>
<br><tt><font size=2>@@ -1436,18 +1274,12 @@ int ehca_rereg_mr(struct ehca_shca
*shca</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_rereg_mr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x shca=%p e_mr=%p iova_start=%p
size=%lx "</font></tt>
<br><tt><font size=2>-
"acl=%x e_pd=%p
pginfo=%p num_pages=%lx lkey=%x rkey=%x"</font></tt>
<br><tt><font size=2>-
" rereg_1_hcall=%x
rereg_3_hcall=%x", ret, shca, e_mr,</font></tt>
<br><tt><font size=2>-
iova_start, size,
acl, e_pd, pginfo, pginfo->num_pages,</font></tt>
<br><tt><font size=2>-
*lkey, *rkey,
rereg_1_hcall, rereg_3_hcall);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x shca=%p e_mr=%p iova_start=%p
size=%lx "</font></tt>
<br><tt><font size=2>-
"acl=%x e_pd=%p
pginfo=%p num_pages=%lx lkey=%x rkey=%x"</font></tt>
<br><tt><font size=2>-
" rereg_1_hcall=%x
rereg_3_hcall=%x", ret, shca, e_mr,</font></tt>
<br><tt><font size=2>-
iova_start, size,
acl, e_pd, pginfo, pginfo->num_pages,</font></tt>
<br><tt><font size=2>-
*lkey, *rkey,
rereg_1_hcall, rereg_3_hcall);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x shca=%p
e_mr=%p "</font></tt>
<br><tt><font size=2>+
"iova_start=%p
size=%lx acl=%x e_pd=%p pginfo=%p "</font></tt>
<br><tt><font size=2>+
"num_pages=%lx
lkey=%x rkey=%x rereg_1_hcall=%x "</font></tt>
<br><tt><font size=2>+
"rereg_3_hcall=%x",
ret, shca, e_mr, iova_start, size,</font></tt>
<br><tt><font size=2>+
acl, e_pd, pginfo,
pginfo->num_pages, *lkey, *rkey,</font></tt>
<br><tt><font size=2>+
rereg_1_hcall,
rereg_3_hcall);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_rereg_mr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1457,26 +1289,22 @@ int ehca_unmap_one_fmr(struct
ehca_shca </font></tt>
<br><tt><font size=2>
struct ehca_mr *e_fmr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> int rereg_1_hcall
= 1; /* 1: use hipz_mr_reregister directly */</font></tt>
<br><tt><font size=2> int rereg_3_hcall
= 0; /* 1: use 3 hipz calls for unmapping */</font></tt>
<br><tt><font size=2>- struct ehca_pd
*e_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*e_pd =</font></tt>
<br><tt><font size=2>+
container_of(e_fmr->ib.ib_fmr.pd, struct ehca_pd,
ib_pd);</font></tt>
<br><tt><font size=2> struct ehca_mr
save_fmr;</font></tt>
<br><tt><font size=2>- u32 tmp_lkey
= 0;</font></tt>
<br><tt><font size=2>- u32 tmp_rkey
= 0;</font></tt>
<br><tt><font size=2>+ u32 tmp_lkey,
tmp_rkey;</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2> struct ehca_mr_hipzout_parms
hipzout = {{0},0,0,0,0,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
e_fmr=%p", shca, e_fmr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* first
check if reregistration hCall can be used for unmap */</font></tt>
<br><tt><font size=2> if (e_fmr->fmr_max_pages
> 512) {</font></tt>
<br><tt><font size=2>
rereg_1_hcall = 0;</font></tt>
<br><tt><font size=2>
rereg_3_hcall = 1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- e_pd = container_of(e_fmr->ib.ib_fmr.pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (rereg_1_hcall)
{</font></tt>
<br><tt><font size=2>
/*</font></tt>
<br><tt><font size=2>
* note: after using rereg hcall with len=0,</font></tt>
<br><tt><font size=2>@@ -1489,10 +1317,10 @@ int ehca_unmap_one_fmr(struct
ehca_shca </font></tt>
<br><tt><font size=2>
* should
not happen, because length checked above,</font></tt>
<br><tt><font size=2>
* FMRs
are not shared and no MW bound to FMRs</font></tt>
<br><tt><font size=2>
*/</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_reregister_pmr
failed (Rereg1), "</font></tt>
<br><tt><font size=2>-
"h_ret=%lx e_fmr=%p hca_hndl=%lx mr_hndl=%lx
"</font></tt>
<br><tt><font size=2>-
"lkey=%x lkey_out=%x", h_ret, e_fmr,</font></tt>
<br><tt><font size=2>-
shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"hipz_reregister_pmr failed "</font></tt>
<br><tt><font size=2>+
"(Rereg1), h_ret=%lx e_fmr=%p hca_hndl=%lx "</font></tt>
<br><tt><font size=2>+
"mr_hndl=%lx lkey=%x lkey_out=%x",</font></tt>
<br><tt><font size=2>+
h_ret, e_fmr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_fmr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_fmr->ib.ib_fmr.lkey, hipzout.lkey);</font></tt>
<br><tt><font size=2>
rereg_3_hcall
= 1;</font></tt>
<br><tt><font size=2>@@ -1511,9 +1339,10 @@ int ehca_unmap_one_fmr(struct
ehca_shca </font></tt>
<br><tt><font size=2>
/* first free old FMR */</font></tt>
<br><tt><font size=2>
h_ret = hipz_h_free_resource_mr(shca->ipz_hca_handle,
e_fmr);</font></tt>
<br><tt><font size=2>
if (h_ret != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_free_mr
failed, h_ret=%lx e_fmr=%p "</font></tt>
<br><tt><font size=2>-
"hca_hndl=%lx mr_hndl=%lx lkey=%x", h_ret,</font></tt>
<br><tt><font size=2>-
e_fmr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,
"hipz_free_mr failed, "</font></tt>
<br><tt><font size=2>+
"h_ret=%lx e_fmr=%p hca_hndl=%lx mr_hndl=%lx
"</font></tt>
<br><tt><font size=2>+
"lkey=%x",</font></tt>
<br><tt><font size=2>+
h_ret, e_fmr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_fmr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_fmr->ib.ib_fmr.lkey);</font></tt>
<br><tt><font size=2>
ret = ehca_mrmw_map_hrc_free_mr(h_ret);</font></tt>
<br><tt><font size=2>@@ -1547,9 +1376,11 @@ int ehca_unmap_one_fmr(struct
ehca_shca </font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_unmap_one_fmr_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
tmp_lkey=%x tmp_rkey=%x fmr_max_pages=%x "</font></tt>
<br><tt><font size=2>-
"rereg_1_hcall=%x rereg_3_hcall=%x", ret,
tmp_lkey, tmp_rkey,</font></tt>
<br><tt><font size=2>-
e_fmr->fmr_max_pages, rereg_1_hcall, rereg_3_hcall);</font></tt>
<br><tt><font size=2>+ if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x tmp_lkey=%x
tmp_rkey=%x "</font></tt>
<br><tt><font size=2>+
"fmr_max_pages=%x
rereg_1_hcall=%x rereg_3_hcall=%x",</font></tt>
<br><tt><font size=2>+
ret, tmp_lkey,
tmp_rkey, e_fmr->fmr_max_pages,</font></tt>
<br><tt><font size=2>+
rereg_1_hcall,
rereg_3_hcall);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_unmap_one_fmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1565,13 +1396,10 @@ int ehca_reg_smr(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2>
u32 *rkey) /*OUT*/</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u32 hipz_acl
= 0;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ u32 hipz_acl;</font></tt>
<br><tt><font size=2> struct ehca_mr_hipzout_parms
hipzout = {{0},0,0,0,0,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7,"shca=%p
e_origmr=%p e_newmr=%p iova_start=%p acl=%x e_pd=%p",</font></tt>
<br><tt><font size=2>-
shca, e_origmr, e_newmr, iova_start, acl, e_pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ehca_mrmw_map_acl(acl,
&hipz_acl);</font></tt>
<br><tt><font size=2> ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1579,10 +1407,11 @@ int ehca_reg_smr(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2>
(u64)iova_start, hipz_acl, e_pd->fw_pd,</font></tt>
<br><tt><font size=2>
&hipzout);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_reg_smr failed, h_ret=%lx shca=%p
e_origmr=%p"</font></tt>
<br><tt><font size=2>-
" e_newmr=%p
iova_start=%p acl=%x e_pd=%p hca_hndl=%lx"</font></tt>
<br><tt><font size=2>-
" mr_hndl=%lx
lkey=%x", h_ret, shca, e_origmr, e_newmr,</font></tt>
<br><tt><font size=2>-
iova_start, acl,
e_pd, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "hipz_reg_smr
failed, h_ret=%lx "</font></tt>
<br><tt><font size=2>+
"shca=%p
e_origmr=%p e_newmr=%p iova_start=%p acl=%x "</font></tt>
<br><tt><font size=2>+
"e_pd=%p
hca_hndl=%lx mr_hndl=%lx lkey=%x",</font></tt>
<br><tt><font size=2>+
h_ret, shca,
e_origmr, e_newmr, iova_start, acl, e_pd,</font></tt>
<br><tt><font size=2>+
shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_origmr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_origmr->ib.ib_mr.lkey);</font></tt>
<br><tt><font size=2>
ret = ehca_mrmw_map_hrc_reg_smr(h_ret);</font></tt>
<br><tt><font size=2>@@ -1597,15 +1426,13 @@ int ehca_reg_smr(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2> e_newmr->ipz_mr_handle
= hipzout.handle;</font></tt>
<br><tt><font size=2> *lkey =
hipzout.lkey;</font></tt>
<br><tt><font size=2> *rkey =
hipzout.rkey;</font></tt>
<br><tt><font size=2>- goto ehca_reg_smr_exit0;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_reg_smr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x shca=%p e_origmr=%p e_newmr=%p
"</font></tt>
<br><tt><font size=2>-
"iova_start=%p
acl=%x e_pd=%p",</font></tt>
<br><tt><font size=2>-
ret, shca, e_origmr,
e_newmr, iova_start, acl, e_pd);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x lkey=%x rkey=%x", ret,
*lkey, *rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x shca=%p
e_origmr=%p "</font></tt>
<br><tt><font size=2>+
"e_newmr=%p
iova_start=%p acl=%x e_pd=%p",</font></tt>
<br><tt><font size=2>+
ret, shca, e_origmr,
e_newmr, iova_start, acl, e_pd);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_smr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1617,27 +1444,18 @@ int ehca_reg_internal_maxmr(</font></tt>
<br><tt><font size=2> struct ehca_pd
*e_pd,</font></tt>
<br><tt><font size=2> struct ehca_mr
**e_maxmr) /*OUT*/</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_mr = NULL;</font></tt>
<br><tt><font size=2>- u64 *iova_start
= NULL;</font></tt>
<br><tt><font size=2>- u64 size_maxmr
= 0;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_mr;</font></tt>
<br><tt><font size=2>+ u64 *iova_start;</font></tt>
<br><tt><font size=2>+ u64 size_maxmr;</font></tt>
<br><tt><font size=2> struct ehca_mr_pginfo
pginfo={0,0,0,0,0,0,0,NULL,0,NULL,NULL,0,NULL,0};</font></tt>
<br><tt><font size=2> struct ib_phys_buf
ib_pbuf;</font></tt>
<br><tt><font size=2>- u32 num_pages_mr
= 0;</font></tt>
<br><tt><font size=2>- u32 num_pages_4k
= 0; /* 4k portion "pages" */</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
e_pd=%p e_maxmr=%p", shca, e_pd, e_maxmr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (ehca_adr_bad(shca)
|| ehca_adr_bad(e_pd) || ehca_adr_bad(e_maxmr)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad input values: shca=%p e_pd=%p
e_maxmr=%p",</font></tt>
<br><tt><font size=2>-
shca, e_pd, e_maxmr);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto ehca_reg_internal_maxmr_exit0;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>+ u32 num_pages_mr;</font></tt>
<br><tt><font size=2>+ u32 num_pages_4k;
/* 4k portion "pages" */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> e_mr = ehca_mr_new();</font></tt>
<br><tt><font size=2> if (!e_mr)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "out of memory");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "out of memory");</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>
goto ehca_reg_internal_maxmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1645,7 +1463,6 @@ int ehca_reg_internal_maxmr(</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* register
internal max-MR on HCA */</font></tt>
<br><tt><font size=2> size_maxmr
= (u64)high_memory - PAGE_OFFSET;</font></tt>
<br><tt><font size=2>- EDEB(7, "high_memory=%p
PAGE_OFFSET=%lx", high_memory, PAGE_OFFSET);</font></tt>
<br><tt><font size=2> iova_start
= (u64*)KERNELBASE;</font></tt>
<br><tt><font size=2> ib_pbuf.addr
= 0;</font></tt>
<br><tt><font size=2> ib_pbuf.size
= size_maxmr;</font></tt>
<br><tt><font size=2>@@ -1664,8 +1481,8 @@ int ehca_reg_internal_maxmr(</font></tt>
<br><tt><font size=2>
&pginfo,
&e_mr->ib.ib_mr.lkey,</font></tt>
<br><tt><font size=2>
&e_mr->ib.ib_mr.rkey);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "reg of internal max MR failed, e_mr=%p
"</font></tt>
<br><tt><font size=2>-
"iova_start=%p
size_maxmr=%lx num_pages_mr=%x "</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "reg of internal
max MR failed, "</font></tt>
<br><tt><font size=2>+
"e_mr=%p
iova_start=%p size_maxmr=%lx num_pages_mr=%x "</font></tt>
<br><tt><font size=2>
"num_pages_4k=%x",
e_mr, iova_start, size_maxmr,</font></tt>
<br><tt><font size=2>
num_pages_mr,
num_pages_4k);</font></tt>
<br><tt><font size=2>
goto ehca_reg_internal_maxmr_exit1;</font></tt>
<br><tt><font size=2>@@ -1678,18 +1495,14 @@ int ehca_reg_internal_maxmr(</font></tt>
<br><tt><font size=2> atomic_inc(&(e_pd->ib_pd.usecnt));</font></tt>
<br><tt><font size=2> atomic_set(&(e_mr->ib.ib_mr.usecnt),
0);</font></tt>
<br><tt><font size=2> *e_maxmr
= e_mr;</font></tt>
<br><tt><font size=2>- goto ehca_reg_internal_maxmr_exit0;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_reg_internal_maxmr_exit1:</font></tt>
<br><tt><font size=2> ehca_mr_delete(e_mr);</font></tt>
<br><tt><font size=2> ehca_reg_internal_maxmr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x shca=%p e_pd=%p e_maxmr=%p",</font></tt>
<br><tt><font size=2>-
ret, shca, e_pd,
e_maxmr);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "*e_maxmr=%p lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
*e_maxmr, (*e_maxmr)->ib.ib_mr.lkey,</font></tt>
<br><tt><font size=2>-
(*e_maxmr)->ib.ib_mr.rkey);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x shca=%p
e_pd=%p e_maxmr=%p",</font></tt>
<br><tt><font size=2>+
ret, shca, e_pd,
e_maxmr);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_internal_maxmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1703,15 +1516,11 @@ int ehca_reg_maxmr(struct
ehca_shca *shc</font></tt>
<br><tt><font size=2>
u32 *lkey,</font></tt>
<br><tt><font size=2>
u32 *rkey)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> struct ehca_mr
*e_origmr = shca->maxmr;</font></tt>
<br><tt><font size=2>- u32 hipz_acl
= 0;</font></tt>
<br><tt><font size=2>+ u32 hipz_acl;</font></tt>
<br><tt><font size=2> struct ehca_mr_hipzout_parms
hipzout = {{0},0,0,0,0,0};</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7,"shca=%p
e_origmr=%p e_newmr=%p iova_start=%p acl=%x e_pd=%p",</font></tt>
<br><tt><font size=2>-
shca, e_origmr, e_newmr, iova_start, acl, e_pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ehca_mrmw_map_acl(acl,
&hipz_acl);</font></tt>
<br><tt><font size=2> ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1719,13 +1528,12 @@ int ehca_reg_maxmr(struct
ehca_shca *shc</font></tt>
<br><tt><font size=2>
(u64)iova_start, hipz_acl, e_pd->fw_pd,</font></tt>
<br><tt><font size=2>
&hipzout);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_reg_smr failed, h_ret=%lx e_origmr=%p
"</font></tt>
<br><tt><font size=2>-
"hca_hndl=%lx
mr_hndl=%lx lkey=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "hipz_reg_smr
failed, h_ret=%lx "</font></tt>
<br><tt><font size=2>+
"e_origmr=%p
hca_hndl=%lx mr_hndl=%lx lkey=%x",</font></tt>
<br><tt><font size=2>
h_ret,
e_origmr, shca->ipz_hca_handle.handle,</font></tt>
<br><tt><font size=2>
e_origmr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
e_origmr->ib.ib_mr.lkey);</font></tt>
<br><tt><font size=2>-
ret = ehca_mrmw_map_hrc_reg_smr(h_ret);</font></tt>
<br><tt><font size=2>-
goto ehca_reg_maxmr_exit0;</font></tt>
<br><tt><font size=2>+
return ehca_mrmw_map_hrc_reg_smr(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> /* successful
registration */</font></tt>
<br><tt><font size=2> e_newmr->num_pages
= e_origmr->num_pages;</font></tt>
<br><tt><font size=2>@@ -1736,24 +1544,19 @@ int ehca_reg_maxmr(struct
ehca_shca *shc</font></tt>
<br><tt><font size=2> e_newmr->ipz_mr_handle
= hipzout.handle;</font></tt>
<br><tt><font size=2> *lkey =
hipzout.lkey;</font></tt>
<br><tt><font size=2> *rkey =
hipzout.rkey;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-ehca_reg_maxmr_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
lkey=%x rkey=%x", ret, *lkey, *rkey);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> } /* end ehca_reg_maxmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /*----------------------------------------------------------------------*/</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_dereg_internal_maxmr(struct ehca_shca
*shca)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_mr
*e_maxmr = NULL;</font></tt>
<br><tt><font size=2>- struct ib_pd
*ib_pd = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "shca=%p
shca->maxmr=%p", shca, shca->maxmr);</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ struct ehca_mr
*e_maxmr;</font></tt>
<br><tt><font size=2>+ struct ib_pd
*ib_pd;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (!shca->maxmr)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad call, shca=%p", shca);</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "bad call,
shca=%p", shca);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto ehca_dereg_internal_maxmr_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1764,7 +1567,7 @@ int ehca_dereg_internal_maxmr(struct
ehc</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_dereg_mr(&e_maxmr->ib.ib_mr);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(3, "dereg internal max-MR failed, "</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "dereg internal
max-MR failed, "</font></tt>
<br><tt><font size=2>
"ret=%x
e_maxmr=%p shca=%p lkey=%x",</font></tt>
<br><tt><font size=2>
ret, e_maxmr,
shca, e_maxmr->ib.ib_mr.lkey);</font></tt>
<br><tt><font size=2>
shca->maxmr = e_maxmr;</font></tt>
<br><tt><font size=2>@@ -1775,10 +1578,8 @@ int ehca_dereg_internal_maxmr(struct
ehc</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_dereg_internal_maxmr_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x shca=%p shca->maxmr=%p",</font></tt>
<br><tt><font size=2>-
ret, shca, shca->maxmr);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "");</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "ret=%x shca=%p
shca->maxmr=%p",</font></tt>
<br><tt><font size=2>+
ret, shca, shca->maxmr);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_dereg_internal_maxmr() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1798,34 +1599,35 @@ int ehca_mr_chk_buf_and_calc_size(struct</font></tt>
<br><tt><font size=2> u32 i;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (num_phys_buf
== 0) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad phys buf array len, num_phys_buf=0");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad phys buf array len, num_phys_buf=0");</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> /* check
first buffer */</font></tt>
<br><tt><font size=2> if (((u64)iova_start
& ~PAGE_MASK) != (pbuf->addr & ~PAGE_MASK)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "iova_start/addr mismatch, iova_start=%p
"</font></tt>
<br><tt><font size=2>-
"pbuf->addr=%lx
pbuf->size=%lx",</font></tt>
<br><tt><font size=2>-
iova_start, pbuf->addr,
pbuf->size);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("iova_start/addr mismatch, iova_start=%p
"</font></tt>
<br><tt><font size=2>+
"pbuf->addr=%lx pbuf->size=%lx",</font></tt>
<br><tt><font size=2>+
iova_start, pbuf->addr, pbuf->size);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (((pbuf->addr
+ pbuf->size) % PAGE_SIZE) &&</font></tt>
<br><tt><font size=2>
(num_phys_buf > 1)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "addr/size mismatch in 1st buf, pbuf->addr=%lx
"</font></tt>
<br><tt><font size=2>-
"pbuf->size=%lx",
pbuf->addr, pbuf->size);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("addr/size mismatch in 1st buf,
pbuf->addr=%lx "</font></tt>
<br><tt><font size=2>+
"pbuf->size=%lx", pbuf->addr, pbuf->size);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> for (i =
0; i < num_phys_buf; i++) {</font></tt>
<br><tt><font size=2>
if ((i > 0) && (pbuf->addr %
PAGE_SIZE)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad
address, i=%x pbuf->addr=%lx "</font></tt>
<br><tt><font size=2>-
"pbuf->size=%lx", i, pbuf->addr,
pbuf->size);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad
address, i=%x pbuf->addr=%lx "</font></tt>
<br><tt><font size=2>+
"pbuf->size=%lx",</font></tt>
<br><tt><font size=2>+
i, pbuf->addr, pbuf->size);</font></tt>
<br><tt><font size=2>
return
-EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
if (((i > 0) &&
/* not 1st */</font></tt>
<br><tt><font size=2>
(i < (num_phys_buf - 1))
&& /* not last */</font></tt>
<br><tt><font size=2>
(pbuf->size % PAGE_SIZE))
|| (pbuf->size == 0)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad
size, i=%x pbuf->size=%lx",</font></tt>
<br><tt><font size=2>-
i, pbuf->size);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad
size, i=%x pbuf->size=%lx",</font></tt>
<br><tt><font size=2>+
i, pbuf->size);</font></tt>
<br><tt><font size=2>
return
-EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
size_count += pbuf->size;</font></tt>
<br><tt><font size=2>@@ -1844,17 +1646,12 @@ int ehca_fmr_check_page_list(struct
ehca</font></tt>
<br><tt><font size=2>
int list_len)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> u32 i;</font></tt>
<br><tt><font size=2>- u64 *page = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (ehca_adr_bad(page_list))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad page_list, page_list=%p fmr=%p",</font></tt>
<br><tt><font size=2>-
page_list, e_fmr);</font></tt>
<br><tt><font size=2>-
return -EINVAL;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>+ u64 *page;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if ((list_len
== 0) || (list_len > e_fmr->fmr_max_pages)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad list_len, list_len=%x e_fmr->fmr_max_pages=%x
"</font></tt>
<br><tt><font size=2>-
"fmr=%p",
list_len, e_fmr->fmr_max_pages, e_fmr);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad list_len, list_len=%x "</font></tt>
<br><tt><font size=2>+
"e_fmr->fmr_max_pages=%x fmr=%p",</font></tt>
<br><tt><font size=2>+
list_len, e_fmr->fmr_max_pages, e_fmr);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1862,9 +1659,9 @@ int ehca_fmr_check_page_list(struct
ehca</font></tt>
<br><tt><font size=2> page = page_list;</font></tt>
<br><tt><font size=2> for (i =
0; i < list_len; i++) {</font></tt>
<br><tt><font size=2>
if (*page % e_fmr->fmr_page_size) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad
page, i=%x *page=%lx page=%p "</font></tt>
<br><tt><font size=2>-
"fmr=%p fmr_page_size=%x",</font></tt>
<br><tt><font size=2>-
i, *page, page, e_fmr, e_fmr->fmr_page_size);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad
page, i=%x *page=%lx page=%p fmr=%p "</font></tt>
<br><tt><font size=2>+
"fmr_page_size=%x", i, *page,
page, e_fmr,</font></tt>
<br><tt><font size=2>+
e_fmr->fmr_page_size);</font></tt>
<br><tt><font size=2>
return
-EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
page++;</font></tt>
<br><tt><font size=2>@@ -1882,24 +1679,14 @@ int ehca_set_pagebuf(struct
ehca_mr *e_m</font></tt>
<br><tt><font size=2>
u64 *kpage)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ib_umem_chunk
*prev_chunk = NULL;</font></tt>
<br><tt><font size=2>- struct ib_umem_chunk
*chunk = NULL;</font></tt>
<br><tt><font size=2>- struct ib_phys_buf
*pbuf = NULL;</font></tt>
<br><tt><font size=2>- u64 *fmrlist
= NULL;</font></tt>
<br><tt><font size=2>- u64 num4k =
0;</font></tt>
<br><tt><font size=2>- u64 pgaddr =
0;</font></tt>
<br><tt><font size=2>- u64 offs4k =
0;</font></tt>
<br><tt><font size=2>+ struct ib_umem_chunk
*prev_chunk;</font></tt>
<br><tt><font size=2>+ struct ib_umem_chunk
*chunk;</font></tt>
<br><tt><font size=2>+ struct ib_phys_buf
*pbuf;</font></tt>
<br><tt><font size=2>+ u64 *fmrlist;</font></tt>
<br><tt><font size=2>+ u64 num4k, pgaddr,
offs4k;</font></tt>
<br><tt><font size=2> u32 i =
0;</font></tt>
<br><tt><font size=2> u32 j =
0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pginfo=%p
type=%x num_pages=%lx num_4k=%lx next_buf=%lx "</font></tt>
<br><tt><font size=2>-
"next_4k=%lx number=%x kpage=%p page_cnt=%lx
page_4k_cnt=%lx "</font></tt>
<br><tt><font size=2>-
"next_listelem=%lx region=%p next_chunk=%p next_nmap=%lx",</font></tt>
<br><tt><font size=2>-
pginfo, pginfo->type, pginfo->num_pages, pginfo->num_4k,</font></tt>
<br><tt><font size=2>-
pginfo->next_buf, pginfo->next_4k, number, kpage,</font></tt>
<br><tt><font size=2>-
pginfo->page_cnt, pginfo->page_4k_cnt, pginfo->next_listelem,</font></tt>
<br><tt><font size=2>-
pginfo->region, pginfo->next_chunk, pginfo->next_nmap);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (pginfo->type
== EHCA_MR_PGI_PHYS) {</font></tt>
<br><tt><font size=2>
/* loop over desired phys_buf_array entries
*/</font></tt>
<br><tt><font size=2>
while (i < number) {</font></tt>
<br><tt><font size=2>@@ -1911,23 +1698,27 @@ int ehca_set_pagebuf(struct
ehca_mr *e_m</font></tt>
<br><tt><font size=2>
/* sanity check */</font></tt>
<br><tt><font size=2>
if ((pginfo->page_cnt >= pginfo->num_pages)
||</font></tt>
<br><tt><font size=2>
(pginfo->page_4k_cnt >=
pginfo->num_4k)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "page_cnt
>= num_pages, "</font></tt>
<br><tt><font size=2>-
"page_cnt=%lx num_pages=%lx "</font></tt>
<br><tt><font size=2>-
"page_4k_cnt=%lx num_4k=%lx "</font></tt>
<br><tt><font size=2>-
"i=%x", pginfo->page_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->num_pages,</font></tt>
<br><tt><font size=2>-
pginfo->page_4k_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->num_4k, i);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("page_cnt
>= num_pages, "</font></tt>
<br><tt><font size=2>+
"page_cnt=%lx "</font></tt>
<br><tt><font size=2>+
"num_pages=%lx "</font></tt>
<br><tt><font size=2>+
"page_4k_cnt=%lx "</font></tt>
<br><tt><font size=2>+
"num_4k=%lx i=%x",</font></tt>
<br><tt><font size=2>+
pginfo->page_cnt,</font></tt>
<br><tt><font size=2>+
pginfo->num_pages,</font></tt>
<br><tt><font size=2>+
pginfo->page_4k_cnt,</font></tt>
<br><tt><font size=2>+
pginfo->num_4k, i);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>+
goto ehca_set_pagebuf_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
*kpage = phys_to_abs(</font></tt>
<br><tt><font size=2>
(pbuf->addr
& EHCA_PAGEMASK)</font></tt>
<br><tt><font size=2>
+ (pginfo->next_4k
* EHCA_PAGESIZE));</font></tt>
<br><tt><font size=2>
if ( !(*kpage) && pbuf->addr ) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "pbuf->addr=%lx
"</font></tt>
<br><tt><font size=2>-
"pbuf->size=%lx next_4k=%lx",</font></tt>
<br><tt><font size=2>-
pbuf->addr, pbuf->size,</font></tt>
<br><tt><font size=2>-
pginfo->next_4k);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("pbuf->addr=%lx
"</font></tt>
<br><tt><font size=2>+
"pbuf->size=%lx "</font></tt>
<br><tt><font size=2>+
"next_4k=%lx", pbuf->addr,</font></tt>
<br><tt><font size=2>+
pbuf->size,</font></tt>
<br><tt><font size=2>+
pginfo->next_4k);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -1952,23 +1743,21 @@ int ehca_set_pagebuf(struct
ehca_mr *e_m</font></tt>
<br><tt><font size=2>
list_for_each_entry_continue(chunk,</font></tt>
<br><tt><font size=2>
(&(pginfo->region->chunk_list)),</font></tt>
<br><tt><font size=2>
list) {</font></tt>
<br><tt><font size=2>-
EDEB(9, "chunk->page_list[0]=%lx",</font></tt>
<br><tt><font size=2>-
(u64)sg_dma_address(&chunk->page_list[0]));</font></tt>
<br><tt><font size=2>
for (i
= pginfo->next_nmap; i < chunk->nmap; ) {</font></tt>
<br><tt><font size=2>
pgaddr = ( page_to_pfn(chunk->page_list[i].page)</font></tt>
<br><tt><font size=2>
<< PAGE_SHIFT );</font></tt>
<br><tt><font size=2>
*kpage = phys_to_abs(pgaddr +</font></tt>
<br><tt><font size=2>
(pginfo->next_4k *</font></tt>
<br><tt><font size=2>
EHCA_PAGESIZE));</font></tt>
<br><tt><font size=2>-
EDEB(9,"pgaddr=%lx *kpage=%lx next_4k=%lx",</font></tt>
<br><tt><font size=2>-
pgaddr, *kpage, pginfo->next_4k);</font></tt>
<br><tt><font size=2>
if ( !(*kpage) ) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "pgaddr=%lx
"</font></tt>
<br><tt><font size=2>-
"chunk->page_list[i]=%lx i=%x "</font></tt>
<br><tt><font size=2>-
"next_4k=%lx mr=%p", pgaddr,</font></tt>
<br><tt><font size=2>-
(u64)sg_dma_address(</font></tt>
<br><tt><font size=2>-
&chunk->page_list[i]),</font></tt>
<br><tt><font size=2>-
i, pginfo->next_4k, e_mr);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("pgaddr=%lx
"</font></tt>
<br><tt><font size=2>+
"chunk->page_list[i]=%lx "</font></tt>
<br><tt><font size=2>+
"i=%x next_4k=%lx mr=%p",</font></tt>
<br><tt><font size=2>+
pgaddr,</font></tt>
<br><tt><font size=2>+
(u64)sg_dma_address(</font></tt>
<br><tt><font size=2>+
&chunk-></font></tt>
<br><tt><font size=2>+
page_list[i]),</font></tt>
<br><tt><font size=2>+
i, pginfo->next_4k, e_mr);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -2009,10 +1798,11 @@ int ehca_set_pagebuf(struct
ehca_mr *e_m</font></tt>
<br><tt><font size=2>
*kpage
= phys_to_abs((*fmrlist & EHCA_PAGEMASK) +</font></tt>
<br><tt><font size=2>
pginfo->next_4k * EHCA_PAGESIZE);</font></tt>
<br><tt><font size=2>
if ( !(*kpage)
) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "*fmrlist=%lx fmrlist=%p "</font></tt>
<br><tt><font size=2>-
"next_listelem=%lx
next_4k=%lx",</font></tt>
<br><tt><font size=2>-
*fmrlist, fmrlist,</font></tt>
<br><tt><font size=2>-
pginfo->next_listelem,pginfo->next_4k);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("*fmrlist=%lx fmrlist=%p "</font></tt>
<br><tt><font size=2>+
"next_listelem=%lx next_4k=%lx",</font></tt>
<br><tt><font size=2>+
*fmrlist, fmrlist,</font></tt>
<br><tt><font size=2>+
pginfo->next_listelem,</font></tt>
<br><tt><font size=2>+
pginfo->next_4k);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -2028,32 +1818,23 @@ int ehca_set_pagebuf(struct
ehca_mr *e_m</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> } else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad pginfo->type=%x", pginfo->type);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad pginfo->type=%x", pginfo->type);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_set_pagebuf_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x e_mr=%p pginfo=%p type=%x
num_pages=%lx "</font></tt>
<br><tt><font size=2>-
"num_4k=%lx
next_buf=%lx next_4k=%lx number=%x "</font></tt>
<br><tt><font size=2>-
"kpage=%p
page_cnt=%lx page_4k_cnt=%lx i=%x "</font></tt>
<br><tt><font size=2>-
"next_listelem=%lx
region=%p next_chunk=%p "</font></tt>
<br><tt><font size=2>-
"next_nmap=%lx",
ret, e_mr, pginfo, pginfo->type,</font></tt>
<br><tt><font size=2>-
pginfo->num_pages,
pginfo->num_4k, pginfo->next_buf,</font></tt>
<br><tt><font size=2>-
pginfo->next_4k,
number, kpage, pginfo->page_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->page_4k_cnt,
i, pginfo->next_listelem,</font></tt>
<br><tt><font size=2>-
pginfo->region,
pginfo->next_chunk, pginfo->next_nmap);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x e_mr=%p pginfo=%p type=%x
num_pages=%lx "</font></tt>
<br><tt><font size=2>-
"num_4k=%lx
next_buf=%lx next_4k=%lx number=%x "</font></tt>
<br><tt><font size=2>-
"kpage=%p
page_cnt=%lx page_4k_cnt=%lx i=%x "</font></tt>
<br><tt><font size=2>-
"next_listelem=%lx
region=%p next_chunk=%p "</font></tt>
<br><tt><font size=2>-
"next_nmap=%lx",
ret, e_mr, pginfo, pginfo->type,</font></tt>
<br><tt><font size=2>-
pginfo->num_pages,
pginfo->num_4k, pginfo->next_buf,</font></tt>
<br><tt><font size=2>-
pginfo->next_4k,
number, kpage, pginfo->page_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->page_4k_cnt,
i, pginfo->next_listelem,</font></tt>
<br><tt><font size=2>-
pginfo->region,
pginfo->next_chunk, pginfo->next_nmap);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("ret=%x e_mr=%p pginfo=%p type=%x
num_pages=%lx "</font></tt>
<br><tt><font size=2>+
"num_4k=%lx next_buf=%lx next_4k=%lx number=%x "</font></tt>
<br><tt><font size=2>+
"kpage=%p page_cnt=%lx page_4k_cnt=%lx i=%x "</font></tt>
<br><tt><font size=2>+
"next_listelem=%lx region=%p next_chunk=%p "</font></tt>
<br><tt><font size=2>+
"next_nmap=%lx", ret, e_mr, pginfo, pginfo->type,</font></tt>
<br><tt><font size=2>+
pginfo->num_pages, pginfo->num_4k,</font></tt>
<br><tt><font size=2>+
pginfo->next_buf, pginfo->next_4k, number, kpage,</font></tt>
<br><tt><font size=2>+
pginfo->page_cnt, pginfo->page_4k_cnt, i,</font></tt>
<br><tt><font size=2>+
pginfo->next_listelem, pginfo->region,</font></tt>
<br><tt><font size=2>+
pginfo->next_chunk, pginfo->next_nmap);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_set_pagebuf() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -2065,30 +1846,20 @@ int ehca_set_pagebuf_1(struct
ehca_mr *e</font></tt>
<br><tt><font size=2>
u64 *rpage)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- struct ib_phys_buf
*tmp_pbuf = NULL;</font></tt>
<br><tt><font size=2>- u64 *fmrlist
= NULL;</font></tt>
<br><tt><font size=2>- struct ib_umem_chunk
*chunk = NULL;</font></tt>
<br><tt><font size=2>- struct ib_umem_chunk
*prev_chunk = NULL;</font></tt>
<br><tt><font size=2>- u64 pgaddr =
0;</font></tt>
<br><tt><font size=2>- u64 num4k = 0;</font></tt>
<br><tt><font size=2>- u64 offs4k =
0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pginfo=%p
type=%x num_pages=%lx num_4k=%lx next_buf=%lx "</font></tt>
<br><tt><font size=2>-
"next_4k=%lx rpage=%p page_cnt=%lx page_4k_cnt=%lx
"</font></tt>
<br><tt><font size=2>-
"next_listelem=%lx region=%p next_chunk=%p next_nmap=%lx",</font></tt>
<br><tt><font size=2>-
pginfo, pginfo->type, pginfo->num_pages, pginfo->num_4k,</font></tt>
<br><tt><font size=2>-
pginfo->next_buf, pginfo->next_4k, rpage, pginfo->page_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->page_4k_cnt, pginfo->next_listelem,
pginfo->region,</font></tt>
<br><tt><font size=2>-
pginfo->next_chunk, pginfo->next_nmap);</font></tt>
<br><tt><font size=2>+ struct ib_phys_buf
*tmp_pbuf;</font></tt>
<br><tt><font size=2>+ u64 *fmrlist;</font></tt>
<br><tt><font size=2>+ struct ib_umem_chunk
*chunk;</font></tt>
<br><tt><font size=2>+ struct ib_umem_chunk
*prev_chunk;</font></tt>
<br><tt><font size=2>+ u64 pgaddr, num4k,
offs4k;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (pginfo->type
== EHCA_MR_PGI_PHYS) {</font></tt>
<br><tt><font size=2>
/* sanity check */</font></tt>
<br><tt><font size=2>
if ((pginfo->page_cnt >= pginfo->num_pages)
||</font></tt>
<br><tt><font size=2>
(pginfo->page_4k_cnt >=
pginfo->num_4k)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "page_cnt
>= num_pages, page_cnt=%lx "</font></tt>
<br><tt><font size=2>-
"num_pages=%lx page_4k_cnt=%lx num_4k=%lx",</font></tt>
<br><tt><font size=2>-
pginfo->page_cnt, pginfo->num_pages,</font></tt>
<br><tt><font size=2>-
pginfo->page_4k_cnt, pginfo->num_4k);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("page_cnt
>= num_pages, page_cnt=%lx "</font></tt>
<br><tt><font size=2>+
"num_pages=%lx page_4k_cnt=%lx
num_4k=%lx",</font></tt>
<br><tt><font size=2>+
pginfo->page_cnt, pginfo->num_pages,</font></tt>
<br><tt><font size=2>+
pginfo->page_4k_cnt, pginfo->num_4k);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_1_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -2099,10 +1870,10 @@ int ehca_set_pagebuf_1(struct
ehca_mr *e</font></tt>
<br><tt><font size=2>
*rpage = phys_to_abs((tmp_pbuf->addr &
EHCA_PAGEMASK) +</font></tt>
<br><tt><font size=2>
(pginfo->next_4k * EHCA_PAGESIZE));</font></tt>
<br><tt><font size=2>
if ( !(*rpage) && tmp_pbuf->addr
) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "tmp_pbuf->addr=%lx"</font></tt>
<br><tt><font size=2>-
" tmp_pbuf->size=%lx next_4k=%lx",</font></tt>
<br><tt><font size=2>-
tmp_pbuf->addr, tmp_pbuf->size,</font></tt>
<br><tt><font size=2>-
pginfo->next_4k);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("tmp_pbuf->addr=%lx"</font></tt>
<br><tt><font size=2>+
" tmp_pbuf->size=%lx next_4k=%lx",</font></tt>
<br><tt><font size=2>+
tmp_pbuf->addr, tmp_pbuf->size,</font></tt>
<br><tt><font size=2>+
pginfo->next_4k);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_1_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -2125,16 +1896,15 @@ int ehca_set_pagebuf_1(struct
ehca_mr *e</font></tt>
<br><tt><font size=2>
<< PAGE_SHIFT);</font></tt>
<br><tt><font size=2>
*rpage
= phys_to_abs(pgaddr +</font></tt>
<br><tt><font size=2>
(pginfo->next_4k * EHCA_PAGESIZE));</font></tt>
<br><tt><font size=2>-
EDEB(9,"pgaddr=%lx
*rpage=%lx next_4k=%lx", pgaddr,</font></tt>
<br><tt><font size=2>-
*rpage, pginfo->next_4k);</font></tt>
<br><tt><font size=2>
if ( !(*rpage)
) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "pgaddr=%lx chunk->page_list[]=%lx
"</font></tt>
<br><tt><font size=2>-
"next_nmap=%lx
next_4k=%lx mr=%p",</font></tt>
<br><tt><font size=2>-
pgaddr, (u64)sg_dma_address(</font></tt>
<br><tt><font size=2>-
&chunk->page_list[</font></tt>
<br><tt><font size=2>-
pginfo->next_nmap]),</font></tt>
<br><tt><font size=2>-
pginfo->next_nmap,
pginfo->next_4k,</font></tt>
<br><tt><font size=2>-
e_mr);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("pgaddr=%lx chunk->page_list[]=%lx"</font></tt>
<br><tt><font size=2>+
" next_nmap=%lx next_4k=%lx mr=%p",</font></tt>
<br><tt><font size=2>+
pgaddr, (u64)sg_dma_address(</font></tt>
<br><tt><font size=2>+
&chunk->page_list[</font></tt>
<br><tt><font size=2>+
pginfo-></font></tt>
<br><tt><font size=2>+
next_nmap]),</font></tt>
<br><tt><font size=2>+
pginfo->next_nmap, pginfo->next_4k,</font></tt>
<br><tt><font size=2>+
e_mr);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_1_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -2161,9 +1931,10 @@ int ehca_set_pagebuf_1(struct
ehca_mr *e</font></tt>
<br><tt><font size=2>
*rpage = phys_to_abs((*fmrlist & EHCA_PAGEMASK)
+</font></tt>
<br><tt><font size=2>
pginfo->next_4k * EHCA_PAGESIZE);</font></tt>
<br><tt><font size=2>
if ( !(*rpage) ) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "*fmrlist=%lx
fmrlist=%p next_listelem=%lx "</font></tt>
<br><tt><font size=2>-
"next_4k=%lx", *fmrlist, fmrlist,</font></tt>
<br><tt><font size=2>-
pginfo->next_listelem, pginfo->next_4k);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("*fmrlist=%lx
fmrlist=%p "</font></tt>
<br><tt><font size=2>+
"next_listelem=%lx next_4k=%lx",</font></tt>
<br><tt><font size=2>+
*fmrlist, fmrlist, pginfo->next_listelem,</font></tt>
<br><tt><font size=2>+
pginfo->next_4k);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_1_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -2176,32 +1947,22 @@ int ehca_set_pagebuf_1(struct
ehca_mr *e</font></tt>
<br><tt><font size=2>
pginfo->next_4k
= 0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> } else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad pginfo->type=%x", pginfo->type);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad pginfo->type=%x", pginfo->type);</font></tt>
<br><tt><font size=2>
ret = -EFAULT;</font></tt>
<br><tt><font size=2>
goto ehca_set_pagebuf_1_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ehca_set_pagebuf_1_exit0:</font></tt>
<br><tt><font size=2> if (ret)</font></tt>
<br><tt><font size=2>-
EDEB_EX(4, "ret=%x e_mr=%p pginfo=%p type=%x
num_pages=%lx "</font></tt>
<br><tt><font size=2>-
"num_4k=%lx
next_buf=%lx next_4k=%lx rpage=%p "</font></tt>
<br><tt><font size=2>-
"page_cnt=%lx
page_4k_cnt=%lx next_listelem=%lx "</font></tt>
<br><tt><font size=2>-
"region=%p
next_chunk=%p next_nmap=%lx", ret, e_mr,</font></tt>
<br><tt><font size=2>-
pginfo, pginfo->type,
pginfo->num_pages, pginfo->num_4k,</font></tt>
<br><tt><font size=2>-
pginfo->next_buf,
pginfo->next_4k, rpage,</font></tt>
<br><tt><font size=2>-
pginfo->page_cnt,
pginfo->page_4k_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->next_listelem,
pginfo->region,</font></tt>
<br><tt><font size=2>-
pginfo->next_chunk,
pginfo->next_nmap);</font></tt>
<br><tt><font size=2>- else</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "ret=%x e_mr=%p pginfo=%p type=%x
num_pages=%lx "</font></tt>
<br><tt><font size=2>-
"num_4k=%lx
next_buf=%lx next_4k=%lx rpage=%p "</font></tt>
<br><tt><font size=2>-
"page_cnt=%lx
page_4k_cnt=%lx next_listelem=%lx "</font></tt>
<br><tt><font size=2>-
"region=%p
next_chunk=%p next_nmap=%lx", ret, e_mr,</font></tt>
<br><tt><font size=2>-
pginfo, pginfo->type,
pginfo->num_pages, pginfo->num_4k,</font></tt>
<br><tt><font size=2>-
pginfo->next_buf,
pginfo->next_4k, rpage,</font></tt>
<br><tt><font size=2>-
pginfo->page_cnt,
pginfo->page_4k_cnt,</font></tt>
<br><tt><font size=2>-
pginfo->next_listelem,
pginfo->region,</font></tt>
<br><tt><font size=2>-
pginfo->next_chunk,
pginfo->next_nmap);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("ret=%x e_mr=%p pginfo=%p type=%x
num_pages=%lx "</font></tt>
<br><tt><font size=2>+
"num_4k=%lx next_buf=%lx next_4k=%lx rpage=%p "</font></tt>
<br><tt><font size=2>+
"page_cnt=%lx page_4k_cnt=%lx next_listelem=%lx "</font></tt>
<br><tt><font size=2>+
"region=%p next_chunk=%p next_nmap=%lx", ret, e_mr,</font></tt>
<br><tt><font size=2>+
pginfo, pginfo->type, pginfo->num_pages,</font></tt>
<br><tt><font size=2>+
pginfo->num_4k, pginfo->next_buf, pginfo->next_4k,</font></tt>
<br><tt><font size=2>+
rpage, pginfo->page_cnt, pginfo->page_4k_cnt,</font></tt>
<br><tt><font size=2>+
pginfo->next_listelem, pginfo->region,</font></tt>
<br><tt><font size=2>+
pginfo->next_chunk, pginfo->next_nmap);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> } /* end ehca_set_pagebuf_1() */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -2217,7 +1978,7 @@ int ehca_mr_is_maxmr(u64 size,</font></tt>
<br><tt><font size=2> /* a MR
is treated as max-MR only if it fits following: */</font></tt>
<br><tt><font size=2> if ((size
== ((u64)high_memory - PAGE_OFFSET)) &&</font></tt>
<br><tt><font size=2>
(iova_start == (void*)KERNELBASE)) {</font></tt>
<br><tt><font size=2>-
EDEB(6, "this is a max-MR");</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("this is a max-MR");</font></tt>
<br><tt><font size=2>
return 1;</font></tt>
<br><tt><font size=2> } else</font></tt>
<br><tt><font size=2>
return 0;</font></tt>
<br><tt><font size=2>@@ -2470,3 +2231,31 @@ void ehca_mr_deletenew(struct
ehca_mr *m</font></tt>
<br><tt><font size=2> mr->nr_of_pages
= 0;</font></tt>
<br><tt><font size=2> mr->pagearray
= NULL;</font></tt>
<br><tt><font size=2> } /* end ehca_mr_deletenew() */</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+int ehca_init_mrmw_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ mr_cache = kmem_cache_create("ehca_cache_mr",</font></tt>
<br><tt><font size=2>+
sizeof(struct ehca_mr), 0,</font></tt>
<br><tt><font size=2>+
SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>+
NULL, NULL);</font></tt>
<br><tt><font size=2>+ if (!mr_cache)</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>+ mw_cache = kmem_cache_create("ehca_cache_mw",</font></tt>
<br><tt><font size=2>+
sizeof(struct ehca_mw), 0,</font></tt>
<br><tt><font size=2>+
SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>+
NULL, NULL);</font></tt>
<br><tt><font size=2>+ if (!mw_cache)
{</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(mr_cache);</font></tt>
<br><tt><font size=2>+
mr_cache = NULL;</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>+ }</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+void ehca_cleanup_mrmw_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ if (mr_cache)</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(mr_cache);</font></tt>
<br><tt><font size=2>+ if (mw_cache)</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(mw_cache);</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_mrmw.h
linux-2.6/drivers/infiniband/hw/ehca/ehca_mrmw.h</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_mrmw.h
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_mrmw.h
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -42,9 +42,6 @@</font></tt>
<br><tt><font size=2> #ifndef _EHCA_MRMW_H_</font></tt>
<br><tt><font size=2> #define _EHCA_MRMW_H_</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#undef DEB_PREFIX</font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "mrmw"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> int ehca_reg_mr(struct ehca_shca *shca,</font></tt>
<br><tt><font size=2>
struct ehca_mr *e_mr,</font></tt>
<br><tt><font size=2>
u64 *iova_start,</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_pd.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_pd.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_pd.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_pd.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -38,29 +38,22 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "vpd "</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/current.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2> #include "ehca_iverbs.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+static struct kmem_cache *pd_cache;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> struct ib_pd *ehca_alloc_pd(struct ib_device
*device,</font></tt>
<br><tt><font size=2>
struct ib_ucontext *context, struct ib_udata *udata)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- struct ib_pd
*mypd = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*pd = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "device=%p
context=%p udata=%p", device, context, udata);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*pd;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_DEVICE_P(device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- pd = kmem_cache_alloc(ehca_module.cache_pd,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2>+ pd = kmem_cache_alloc(pd_cache,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2> if (!pd)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "ERROR device=%p context=%p pd=%p"</font></tt>
<br><tt><font size=2>-
" out of
memory", device, context, mypd);</font></tt>
<br><tt><font size=2>+
ehca_err(device, "device=%p context=%p out of
memory",</font></tt>
<br><tt><font size=2>+
device, context);</font></tt>
<br><tt><font size=2>
return ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -82,39 +75,40 @@ struct ib_pd *ehca_alloc_pd(struct
ib_de</font></tt>
<br><tt><font size=2> } else</font></tt>
<br><tt><font size=2>
pd->fw_pd.value = (u64)pd;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- mypd = &pd->ib_pd;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_REGISTER_PD(device,
pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "device=%p
context=%p pd=%p", device, context, mypd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return mypd;</font></tt>
<br><tt><font size=2>+ return &pd->ib_pd;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_dealloc_pd(struct ib_pd *pd)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pd=%p",
pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD(pd);</font></tt>
<br><tt><font size=2>- my_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_DEREGISTER_PD(pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_pd,</font></tt>
<br><tt><font size=2>+ kmem_cache_free(pd_cache,</font></tt>
<br><tt><font size=2>
container_of(pd,
struct ehca_pd, ib_pd));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "pd=%p",
pd);</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+int ehca_init_pd_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ pd_cache = kmem_cache_create("ehca_cache_pd",</font></tt>
<br><tt><font size=2>+
sizeof(struct ehca_pd), 0,</font></tt>
<br><tt><font size=2>+
SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>+
NULL, NULL);</font></tt>
<br><tt><font size=2>+ if (!pd_cache)</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+void ehca_cleanup_pd_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ if (pd_cache)</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(pd_cache);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_qp.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_qp.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_qp.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_qp.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -42,8 +42,6 @@</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "e_qp"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/current.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2>@@ -53,6 +51,8 @@</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> #include "hipz_fns.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+static struct kmem_cache *qp_cache;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> /*</font></tt>
<br><tt><font size=2> * attributes not supported by query qp</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2>@@ -114,7 +114,7 @@ static inline enum ehca_qp_state
ib2ehca</font></tt>
<br><tt><font size=2> case IB_QPS_ERR:</font></tt>
<br><tt><font size=2>
return EHCA_QPS_ERR;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "invalid ib_qp_state=%x", ib_qp_state);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("invalid ib_qp_state=%x", ib_qp_state);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -142,7 +142,7 @@ static inline enum ib_qp_state
ehca2ib_q</font></tt>
<br><tt><font size=2> case EHCA_QPS_ERR:</font></tt>
<br><tt><font size=2>
return IB_QPS_ERR;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"invalid ehca_qp_state=%x",ehca_qp_state);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("invalid ehca_qp_state=%x",
ehca_qp_state);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -176,7 +176,7 @@ static inline enum ehca_qp_type
ib2ehcaq</font></tt>
<br><tt><font size=2> case IB_QPT_UD:</font></tt>
<br><tt><font size=2>
return QPT_UD;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"Invalid ibqptype=%x", ibqptype);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid ibqptype=%x", ibqptype);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -190,24 +190,34 @@ static inline enum ib_qp_statetrans
get_</font></tt>
<br><tt><font size=2>
index = IB_QPST_ANY2RESET;</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case IB_QPS_INIT:</font></tt>
<br><tt><font size=2>-
if (ib_fromstate == IB_QPS_RESET)</font></tt>
<br><tt><font size=2>+
switch (ib_fromstate) {</font></tt>
<br><tt><font size=2>+
case IB_QPS_RESET:</font></tt>
<br><tt><font size=2>
index =
IB_QPST_RESET2INIT;</font></tt>
<br><tt><font size=2>-
else if (ib_fromstate == IB_QPS_INIT)</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+
case IB_QPS_INIT:</font></tt>
<br><tt><font size=2>
index =
IB_QPST_INIT2INIT;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+
}</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case IB_QPS_RTR:</font></tt>
<br><tt><font size=2>
if (ib_fromstate == IB_QPS_INIT)</font></tt>
<br><tt><font size=2>
index =
IB_QPST_INIT2RTR;</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case IB_QPS_RTS:</font></tt>
<br><tt><font size=2>-
if (ib_fromstate == IB_QPS_RTR)</font></tt>
<br><tt><font size=2>+
switch (ib_fromstate) {</font></tt>
<br><tt><font size=2>+
case IB_QPS_RTR:</font></tt>
<br><tt><font size=2>
index =
IB_QPST_RTR2RTS;</font></tt>
<br><tt><font size=2>-
else if (ib_fromstate == IB_QPS_RTS)</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+
case IB_QPS_RTS:</font></tt>
<br><tt><font size=2>
index =
IB_QPST_RTS2RTS;</font></tt>
<br><tt><font size=2>-
else if (ib_fromstate == IB_QPS_SQD)</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+
case IB_QPS_SQD:</font></tt>
<br><tt><font size=2>
index =
IB_QPST_SQD2RTS;</font></tt>
<br><tt><font size=2>-
else if (ib_fromstate == IB_QPS_SQE)</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+
case IB_QPS_SQE:</font></tt>
<br><tt><font size=2>
index =
IB_QPST_SQE2RTS;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+
}</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> case IB_QPS_SQD:</font></tt>
<br><tt><font size=2>
if (ib_fromstate == IB_QPS_RTS)</font></tt>
<br><tt><font size=2>@@ -252,7 +262,7 @@ static inline int ibqptype2servicetype(e</font></tt>
<br><tt><font size=2> case IB_QPT_RAW_ETY:</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid ibqptype=%x", ibqptype);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid ibqptype=%x", ibqptype);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -260,7 +270,7 @@ static inline int ibqptype2servicetype(e</font></tt>
<br><tt><font size=2> /*</font></tt>
<br><tt><font size=2> * init_qp_queues initializes/constructs r/squeue
and registers queue pages.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2>-static inline int init_qp_queues(struct ipz_adapter_handle
ipz_hca_handle,</font></tt>
<br><tt><font size=2>+static inline int init_qp_queues(struct ehca_shca
*shca,</font></tt>
<br><tt><font size=2>
struct ehca_qp *my_qp,</font></tt>
<br><tt><font size=2>
int nr_sq_pages,</font></tt>
<br><tt><font size=2>
int nr_rq_pages,</font></tt>
<br><tt><font size=2>@@ -268,28 +278,26 @@ static inline int init_qp_queues(struct
</font></tt>
<br><tt><font size=2>
int rwqe_size,</font></tt>
<br><tt><font size=2>
int nr_send_sges, int nr_receive_sges)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = -EINVAL;</font></tt>
<br><tt><font size=2>- int cnt = 0;</font></tt>
<br><tt><font size=2>- void *vpage =
NULL;</font></tt>
<br><tt><font size=2>- u64 rpage = 0;</font></tt>
<br><tt><font size=2>- int ipz_rc =
-1;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_PARAMETER;</font></tt>
<br><tt><font size=2>+ int ret, cnt,
ipz_rc;</font></tt>
<br><tt><font size=2>+ void *vpage;</font></tt>
<br><tt><font size=2>+ u64 rpage, h_ret;</font></tt>
<br><tt><font size=2>+ struct ib_device
*ib_dev = &shca->ib_device;</font></tt>
<br><tt><font size=2>+ struct ipz_adapter_handle
ipz_hca_handle = shca->ipz_hca_handle;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ipz_rc =
ipz_queue_ctor(&my_qp->ipz_squeue,</font></tt>
<br><tt><font size=2>
nr_sq_pages,</font></tt>
<br><tt><font size=2>
EHCA_PAGESIZE, swqe_size, nr_send_sges);</font></tt>
<br><tt><font size=2> if (!ipz_rc)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot allocate page for squeue.
ipz_rc=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,"Cannot allocate page for squeue.
ipz_rc=%x",</font></tt>
<br><tt><font size=2>
ipz_rc);</font></tt>
<br><tt><font size=2>-
ret = -EBUSY;</font></tt>
<br><tt><font size=2>-
return ret;</font></tt>
<br><tt><font size=2>+
return -EBUSY;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ipz_rc =
ipz_queue_ctor(&my_qp->ipz_rqueue,</font></tt>
<br><tt><font size=2>
nr_rq_pages,</font></tt>
<br><tt><font size=2>
EHCA_PAGESIZE, rwqe_size, nr_receive_sges);</font></tt>
<br><tt><font size=2> if (!ipz_rc)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Cannot allocate page for rqueue.
ipz_rc=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "Cannot allocate page for rqueue.
ipz_rc=%x",</font></tt>
<br><tt><font size=2>
ipz_rc);</font></tt>
<br><tt><font size=2>
ret = -EBUSY;</font></tt>
<br><tt><font size=2>
goto init_qp_queues0;</font></tt>
<br><tt><font size=2>@@ -298,7 +306,7 @@ static inline int init_qp_queues(struct
</font></tt>
<br><tt><font size=2> for (cnt
= 0; cnt < nr_sq_pages; cnt++) {</font></tt>
<br><tt><font size=2>
vpage = ipz_qpageit_get_inc(&my_qp->ipz_squeue);</font></tt>
<br><tt><font size=2>
if (!vpage) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "SQ
ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,
"SQ ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>
"failed p_vpage= %p", vpage);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>@@ -311,8 +319,8 @@ static inline int init_qp_queues(struct
</font></tt>
<br><tt><font size=2>
rpage, 1,</font></tt>
<br><tt><font size=2>
my_qp->galpas.kernel);</font></tt>
<br><tt><font size=2>
if (h_ret < H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"SQ
hipz_qp_register_rpage() faield "</font></tt>
<br><tt><font size=2>-
"rc=%lx", h_ret);</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,
"SQ hipz_qp_register_rpage()"</font></tt>
<br><tt><font size=2>+
" failed rc=%lx", h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -324,9 +332,8 @@ static inline int init_qp_queues(struct
</font></tt>
<br><tt><font size=2> for (cnt
= 0; cnt < nr_rq_pages; cnt++) {</font></tt>
<br><tt><font size=2>
vpage = ipz_qpageit_get_inc(&my_qp->ipz_rqueue);</font></tt>
<br><tt><font size=2>
if (!vpage) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"RQ
ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,
"RQ ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>
"failed p_vpage = %p", vpage);</font></tt>
<br><tt><font size=2>-
h_ret = H_RESOURCE;</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -338,29 +345,28 @@ static inline int init_qp_queues(struct
</font></tt>
<br><tt><font size=2>
&my_qp->pf, 0, 1,</font></tt>
<br><tt><font size=2>
rpage, 1,my_qp->galpas.kernel);</font></tt>
<br><tt><font size=2>
if (h_ret < H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "RQ
hipz_qp_register_rpage() failed "</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev,
"RQ hipz_qp_register_rpage() failed "</font></tt>
<br><tt><font size=2>
"rc=%lx", h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
if (cnt == (nr_rq_pages - 1)) {
/* last page! */</font></tt>
<br><tt><font size=2>
if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"RQ hipz_qp_register_rpage() "</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "RQ hipz_qp_register_rpage()
"</font></tt>
<br><tt><font size=2>
"h_ret=
%lx ", h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
vpage =
ipz_qpageit_get_inc(&my_qp->ipz_rqueue);</font></tt>
<br><tt><font size=2>
if (vpage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>-
"should
not succeed vpage=%p",</font></tt>
<br><tt><font size=2>-
vpage);</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "ipz_qpageit_get_inc() "</font></tt>
<br><tt><font size=2>+
"should
not succeed vpage=%p", vpage);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
} else {</font></tt>
<br><tt><font size=2>
if (h_ret
!= H_PAGE_REGISTERED) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"RQ hipz_qp_register_rpage() "</font></tt>
<br><tt><font size=2>+
ehca_err(ib_dev, "RQ hipz_qp_register_rpage()
"</font></tt>
<br><tt><font size=2>
"h_ret=
%lx ", h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto init_qp_queues1;</font></tt>
<br><tt><font size=2>@@ -379,37 +385,30 @@ init_qp_queues0:</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> struct ib_qp *ehca_create_qp(struct ib_pd *pd,</font></tt>
<br><tt><font size=2>
struct ib_qp_init_attr *init_attr,</font></tt>
<br><tt><font size=2>
struct ib_udata *udata)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- static int da_msg_size[]={
128, 256, 512, 1024, 2048, 4096 };</font></tt>
<br><tt><font size=2>- int ret = -EINVAL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>+ static int da_rc_msg_size[]={
128, 256, 512, 1024, 2048, 4096 };</font></tt>
<br><tt><font size=2>+ static int da_ud_sq_msg_size[]={
128, 384, 896, 1920, 3968 };</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(pd, struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(pd->device, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2> struct ib_ucontext
*context = NULL;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_PARAMETER;</font></tt>
<br><tt><font size=2>- int max_send_sge;</font></tt>
<br><tt><font size=2>- int max_recv_sge;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ int max_send_sge,
max_recv_sge, ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* h_call's
out parameters */</font></tt>
<br><tt><font size=2> struct ehca_alloc_qp_parms
parms;</font></tt>
<br><tt><font size=2>- u32 qp_nr = 0,
swqe_size = 0, rwqe_size = 0;</font></tt>
<br><tt><font size=2>+ u32 swqe_size
= 0, rwqe_size = 0;</font></tt>
<br><tt><font size=2> u8 daqp_completion,
isdaqp;</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7,"pd=%p
init_attr=%p", pd, init_attr);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_PD_P(pd);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR_P(init_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (init_attr->sq_sig_type
!= IB_SIGNAL_REQ_WR &&</font></tt>
<br><tt><font size=2>
init_attr->sq_sig_type != IB_SIGNAL_ALL_WR)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "init_attr->sg_sig_type=%x not
allowed",</font></tt>
<br><tt><font size=2>-
init_attr->sq_sig_type);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "init_attr->sg_sig_type=%x
not allowed",</font></tt>
<br><tt><font size=2>+
init_attr->sq_sig_type);</font></tt>
<br><tt><font size=2>
return ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -424,20 +423,36 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
init_attr->qp_type != IB_QPT_GSI &&</font></tt>
<br><tt><font size=2>
init_attr->qp_type != IB_QPT_UC &&</font></tt>
<br><tt><font size=2>
init_attr->qp_type != IB_QPT_RC) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"wrong QP Type=%x",init_attr->qp_type);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "wrong QP Type=%x",
init_attr->qp_type);</font></tt>
<br><tt><font size=2>
return ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- if (init_attr->qp_type
!= IB_QPT_RC && isdaqp != 0) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"unsupported LL QP Type=%x",init_attr->qp_type);</font></tt>
<br><tt><font size=2>+ if ((init_attr->qp_type
!= IB_QPT_RC && init_attr->qp_type != IB_QPT_UD)</font></tt>
<br><tt><font size=2>+ &&
isdaqp) {</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "unsupported LL QP Type=%x",</font></tt>
<br><tt><font size=2>+
init_attr->qp_type);</font></tt>
<br><tt><font size=2>+
return ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>+ } else if (init_attr->qp_type
== IB_QPT_RC && isdaqp &&</font></tt>
<br><tt><font size=2>+
(init_attr->cap.max_send_wr > 255 ||</font></tt>
<br><tt><font size=2>+
init_attr->cap.max_recv_wr > 255
)) {</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "Invalid
Number of max_sq_wr =%x "</font></tt>
<br><tt><font size=2>+
"or max_rq_wr=%x for QP Type=%x",</font></tt>
<br><tt><font size=2>+
init_attr->cap.max_send_wr,</font></tt>
<br><tt><font size=2>+
init_attr->cap.max_recv_wr,init_attr->qp_type);</font></tt>
<br><tt><font size=2>+
return ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2>+ } else if (init_attr->qp_type
== IB_QPT_UD && isdaqp &&</font></tt>
<br><tt><font size=2>+
init_attr->cap.max_send_wr > 255) {</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,</font></tt>
<br><tt><font size=2>+
"Invalid
Number of max_send_wr=%x for UD QP_TYPE=%x",</font></tt>
<br><tt><font size=2>+
init_attr->cap.max_send_wr,
init_attr->qp_type);</font></tt>
<br><tt><font size=2>
return ERR_PTR(-EINVAL);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (pd->uobject
&& udata)</font></tt>
<br><tt><font size=2>
context = pd->uobject->context;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- my_qp = kmem_cache_alloc(ehca_module.cache_qp,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2>+ my_qp = kmem_cache_alloc(qp_cache,
SLAB_KERNEL);</font></tt>
<br><tt><font size=2> if (!my_qp)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "pd=%p not enough memory to alloc
qp", pd);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "pd=%p not enough memory
to alloc qp", pd);</font></tt>
<br><tt><font size=2>
return ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -446,9 +461,6 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2> spin_lock_init(&my_qp->spinlock_s);</font></tt>
<br><tt><font size=2> spin_lock_init(&my_qp->spinlock_r);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- my_pd = container_of(pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- shca = container_of(pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2> my_qp->recv_cq
=</font></tt>
<br><tt><font size=2>
container_of(init_attr->recv_cq, struct
ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2> my_qp->send_cq
=</font></tt>
<br><tt><font size=2>@@ -459,7 +471,7 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2> do {</font></tt>
<br><tt><font size=2>
if (!idr_pre_get(&ehca_qp_idr, GFP_KERNEL))
{</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't
reserve idr resources.");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Can't reserve idr resources.");</font></tt>
<br><tt><font size=2>
goto create_qp_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -471,14 +483,14 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't allocate new idr entry.");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "Can't allocate new idr
entry.");</font></tt>
<br><tt><font size=2>
goto create_qp_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> parms.servicetype
= ibqptype2servicetype(init_attr->qp_type);</font></tt>
<br><tt><font size=2> if (parms.servicetype
< 0) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid qp_type=%x", init_attr->qp_type);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "Invalid qp_type=%x",
init_attr->qp_type);</font></tt>
<br><tt><font size=2>
goto create_qp_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -497,8 +509,6 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
max_recv_sge += 2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "isdaqp=%x
daqp_completion=%x", isdaqp, daqp_completion);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> parms.ipz_eq_handle
= shca->eq.ipz_eq_handle;</font></tt>
<br><tt><font size=2> parms.daqp_ctrl
= isdaqp | daqp_completion;</font></tt>
<br><tt><font size=2> parms.pd
= my_pd->fw_pd;</font></tt>
<br><tt><font size=2>@@ -508,7 +518,8 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_alloc_resource_qp(shca->ipz_hca_handle, my_qp, &parms);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "h_alloc_resource_qp() failed h_ret=%lx",
h_ret);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device, "h_alloc_resource_qp()
failed h_ret=%lx",</font></tt>
<br><tt><font size=2>+
h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto create_qp_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -521,8 +532,8 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
rwqe_size
= offsetof(struct ehca_wqe, u.nud.sg_list[</font></tt>
<br><tt><font size=2>
(parms.act_nr_recv_sges)]);</font></tt>
<br><tt><font size=2>
} else { /* for daqp we need to use msg size,
not wqe size */</font></tt>
<br><tt><font size=2>-
swqe_size = da_msg_size[max_send_sge];</font></tt>
<br><tt><font size=2>-
rwqe_size = da_msg_size[max_recv_sge];</font></tt>
<br><tt><font size=2>+
swqe_size = da_rc_msg_size[max_send_sge];</font></tt>
<br><tt><font size=2>+
rwqe_size = da_rc_msg_size[max_recv_sge];</font></tt>
<br><tt><font size=2>
parms.act_nr_send_sges
= 1;</font></tt>
<br><tt><font size=2>
parms.act_nr_recv_sges
= 1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -540,10 +551,17 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
/* UD circumvention */</font></tt>
<br><tt><font size=2>
parms.act_nr_recv_sges -= 2;</font></tt>
<br><tt><font size=2>
parms.act_nr_send_sges -= 2;</font></tt>
<br><tt><font size=2>-
swqe_size = offsetof(struct ehca_wqe,</font></tt>
<br><tt><font size=2>-
u.ud_av.sg_list[parms.act_nr_send_sges]);</font></tt>
<br><tt><font size=2>-
rwqe_size = offsetof(struct ehca_wqe,</font></tt>
<br><tt><font size=2>-
u.ud_av.sg_list[parms.act_nr_recv_sges]);</font></tt>
<br><tt><font size=2>+
if (isdaqp) {</font></tt>
<br><tt><font size=2>+
swqe_size = da_ud_sq_msg_size[max_send_sge];</font></tt>
<br><tt><font size=2>+
rwqe_size = da_rc_msg_size[max_recv_sge];</font></tt>
<br><tt><font size=2>+
parms.act_nr_send_sges
= 1;</font></tt>
<br><tt><font size=2>+
parms.act_nr_recv_sges
= 1;</font></tt>
<br><tt><font size=2>+
} else {</font></tt>
<br><tt><font size=2>+
swqe_size = offsetof(struct
ehca_wqe,</font></tt>
<br><tt><font size=2>+
u.ud_av.sg_list[parms.act_nr_send_sges]);</font></tt>
<br><tt><font size=2>+
rwqe_size = offsetof(struct
ehca_wqe,</font></tt>
<br><tt><font size=2>+
u.ud_av.sg_list[parms.act_nr_recv_sges]);</font></tt>
<br><tt><font size=2>+
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (IB_QPT_GSI == init_attr->qp_type ||</font></tt>
<br><tt><font size=2>
IB_QPT_SMI == init_attr->qp_type)
{</font></tt>
<br><tt><font size=2>@@ -562,13 +580,13 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* initializes
r/squeue and registers queue pages */</font></tt>
<br><tt><font size=2>- ret = init_qp_queues(shca->ipz_hca_handle,
my_qp,</font></tt>
<br><tt><font size=2>+ ret = init_qp_queues(shca,
my_qp,</font></tt>
<br><tt><font size=2>
parms.nr_sq_pages, parms.nr_rq_pages,</font></tt>
<br><tt><font size=2>
swqe_size, rwqe_size,</font></tt>
<br><tt><font size=2>
parms.act_nr_send_sges, parms.act_nr_recv_sges);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"Couldn't initialize r/squeue and
pages ret=%x",</font></tt>
<br><tt><font size=2>-
ret);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,</font></tt>
<br><tt><font size=2>+
"Couldn't
initialize r/squeue and pages ret=%x", ret);</font></tt>
<br><tt><font size=2>
goto create_qp_exit2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -597,7 +615,8 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2> if (init_attr->qp_type
== IB_QPT_GSI) {</font></tt>
<br><tt><font size=2>
h_ret = ehca_define_sqp(shca, my_qp, init_attr);</font></tt>
<br><tt><font size=2>
if (h_ret != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "ehca_define_sqp()
failed rc=%lx",h_ret);</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"ehca_define_sqp() failed rc=%lx",</font></tt>
<br><tt><font size=2>+
h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto create_qp_exit3;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -607,7 +626,7 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>
ret = ehca_cq_assign_qp(cq, my_qp);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Couldn't
assign qp to send_cq ret=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Couldn't assign qp to send_cq ret=%x",</font></tt>
<br><tt><font size=2>
ret);</font></tt>
<br><tt><font size=2>
goto create_qp_exit3;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -637,7 +656,7 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
(void**)&resp.ipz_rqueue.queue,</font></tt>
<br><tt><font size=2>
&vma);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could
not mmap rqueue pages");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Could not mmap rqueue pages");</font></tt>
<br><tt><font size=2>
goto create_qp_exit3;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
my_qp->uspace_rqueue = resp.ipz_rqueue.queue;</font></tt>
<br><tt><font size=2>@@ -652,7 +671,7 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
(void**)&resp.ipz_squeue.queue,</font></tt>
<br><tt><font size=2>
&vma);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could
not mmap squeue pages");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Could not mmap squeue pages");</font></tt>
<br><tt><font size=2>
goto create_qp_exit4;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
my_qp->uspace_squeue = resp.ipz_squeue.queue;</font></tt>
<br><tt><font size=2>@@ -662,20 +681,18 @@ struct ib_qp *ehca_create_qp(struct
ib_p</font></tt>
<br><tt><font size=2>
(void**)&resp.galpas.kernel.fw_handle,</font></tt>
<br><tt><font size=2>
&vma);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could
not mmap fw_handle");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Could not mmap fw_handle");</font></tt>
<br><tt><font size=2>
goto create_qp_exit5;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
my_qp->uspace_fwh = (u64)resp.galpas.kernel.fw_handle;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (ib_copy_to_udata(udata, &resp, sizeof
resp)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Copy
to udata failed");</font></tt>
<br><tt><font size=2>+
ehca_err(pd->device,
"Copy to udata failed");</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto create_qp_exit6;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x, token=%x",</font></tt>
<br><tt><font size=2>-
my_qp, qp_nr, my_qp->token);</font></tt>
<br><tt><font size=2> return &my_qp->ib_qp;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_qp_exit6:</font></tt>
<br><tt><font size=2>@@ -700,10 +717,8 @@ create_qp_exit1:</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&ehca_qp_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> create_qp_exit0:</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_qp,
my_qp);</font></tt>
<br><tt><font size=2>- EDEB_EX(4, "failed
ret=%x", ret);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(qp_cache,
my_qp);</font></tt>
<br><tt><font size=2> return ERR_PTR(ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /*</font></tt>
<br><tt><font size=2>@@ -714,48 +729,45 @@ create_qp_exit0:</font></tt>
<br><tt><font size=2> static int prepare_sqe_rts(struct ehca_qp *my_qp,
struct ehca_shca *shca,</font></tt>
<br><tt><font size=2>
int *bad_wqe_cnt)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- struct ipz_queue
*squeue = NULL;</font></tt>
<br><tt><font size=2>- void *bad_send_wqe_p
= NULL;</font></tt>
<br><tt><font size=2>- void *bad_send_wqe_v
= NULL;</font></tt>
<br><tt><font size=2>- void *squeue_start_p
= NULL;</font></tt>
<br><tt><font size=2>- void *squeue_end_p
= NULL;</font></tt>
<br><tt><font size=2>- void *squeue_start_v
= NULL;</font></tt>
<br><tt><font size=2>- void *squeue_end_v
= NULL;</font></tt>
<br><tt><font size=2>- struct ehca_wqe
*wqe = NULL;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ struct ipz_queue
*squeue;</font></tt>
<br><tt><font size=2>+ void *bad_send_wqe_p,
*bad_send_wqe_v;</font></tt>
<br><tt><font size=2>+ void *squeue_start_p,
*squeue_end_p;</font></tt>
<br><tt><font size=2>+ void *squeue_start_v,
*squeue_end_v;</font></tt>
<br><tt><font size=2>+ struct ehca_wqe
*wqe;</font></tt>
<br><tt><font size=2> int qp_num
= my_qp->ib_qp.qp_num;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x ", my_qp, qp_num);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* get send
wqe pointer */</font></tt>
<br><tt><font size=2> h_ret =
hipz_h_disable_and_get_wqe(shca->ipz_hca_handle,</font></tt>
<br><tt><font size=2>
my_qp->ipz_qp_handle, &my_qp->pf,</font></tt>
<br><tt><font size=2>
&bad_send_wqe_p, NULL, 2);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_h_disable_and_get_wqe() failed
"</font></tt>
<br><tt><font size=2>-
"ehca_qp=%p
qp_num=%x h_ret=%lx",my_qp, qp_num, h_ret);</font></tt>
<br><tt><font size=2>-
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>-
goto prepare_sqe_rts_exit1;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "hipz_h_disable_and_get_wqe()
failed"</font></tt>
<br><tt><font size=2>+
" ehca_qp=%p
qp_num=%x h_ret=%lx",</font></tt>
<br><tt><font size=2>+
my_qp, qp_num,
h_ret);</font></tt>
<br><tt><font size=2>+
return ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> bad_send_wqe_p
= (void*)((u64)bad_send_wqe_p & (~(1L<<63)));</font></tt>
<br><tt><font size=2>- EDEB(7, "qp_num=%x
bad_send_wqe_p=%p", qp_num, bad_send_wqe_p);</font></tt>
<br><tt><font size=2>+ ehca_dbg(&shca->ib_device,
"qp_num=%x bad_send_wqe_p=%p",</font></tt>
<br><tt><font size=2>+
qp_num, bad_send_wqe_p);</font></tt>
<br><tt><font size=2> /* convert
wqe pointer to vadr */</font></tt>
<br><tt><font size=2> bad_send_wqe_v
= abs_to_virt((u64)bad_send_wqe_p);</font></tt>
<br><tt><font size=2>- EDEB_DMP(6, bad_send_wqe_v,
32, "qp_num=%x bad_wqe", qp_num);</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(bad_send_wqe_v, 32, "qp_num=%x bad_wqe",
qp_num);</font></tt>
<br><tt><font size=2> squeue =
&my_qp->ipz_squeue;</font></tt>
<br><tt><font size=2> squeue_start_p
= (void*)virt_to_abs(ipz_qeit_calc(squeue, 0L));</font></tt>
<br><tt><font size=2> squeue_end_p
= squeue_start_p+squeue->queue_length;</font></tt>
<br><tt><font size=2> squeue_start_v
= abs_to_virt((u64)squeue_start_p);</font></tt>
<br><tt><font size=2> squeue_end_v
= abs_to_virt((u64)squeue_end_p);</font></tt>
<br><tt><font size=2>- EDEB(6, "qp_num=%x
squeue_start_v=%p squeue_end_v=%p",</font></tt>
<br><tt><font size=2>-
qp_num, squeue_start_v, squeue_end_v);</font></tt>
<br><tt><font size=2>+ ehca_dbg(&shca->ib_device,
"qp_num=%x squeue_start_v=%p squeue_end_v=%p",</font></tt>
<br><tt><font size=2>+
qp_num, squeue_start_v, squeue_end_v);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* loop
sets wqe's purge bit */</font></tt>
<br><tt><font size=2> wqe = (struct
ehca_wqe*)bad_send_wqe_v;</font></tt>
<br><tt><font size=2> *bad_wqe_cnt
= 0;</font></tt>
<br><tt><font size=2> while (wqe->optype
!= 0xff && wqe->wqef != 0xff) {</font></tt>
<br><tt><font size=2>-
EDEB_DMP(6, wqe, 32, "qp_num=%x wqe", qp_num);</font></tt>
<br><tt><font size=2>+
if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(wqe,
32, "qp_num=%x wqe", qp_num);</font></tt>
<br><tt><font size=2>
wqe->nr_of_data_seg = 0; /* suppress data
access */</font></tt>
<br><tt><font size=2>
wqe->wqef = WQEF_PURGE; /* WQE to be purged
*/</font></tt>
<br><tt><font size=2>
wqe = (struct ehca_wqe*)((u8*)wqe+squeue->qe_size);</font></tt>
<br><tt><font size=2>@@ -768,13 +780,11 @@ static int prepare_sqe_rts(struct
ehca_q</font></tt>
<br><tt><font size=2> * bad wqe
will be reprocessed and ignored when pol_cq() is called,</font></tt>
<br><tt><font size=2> * i.e.
nr of wqes with flush error status is one less</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2>- EDEB(6, "qp_num=%x
flusherr_wqe_cnt=%x", qp_num, (*bad_wqe_cnt)-1);</font></tt>
<br><tt><font size=2>+ ehca_dbg(&shca->ib_device,
"qp_num=%x flusherr_wqe_cnt=%x",</font></tt>
<br><tt><font size=2>+
qp_num, (*bad_wqe_cnt)-1);</font></tt>
<br><tt><font size=2> wqe->wqef
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-prepare_sqe_rts_exit1:</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x ret=%x", my_qp, qp_num, ret);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /*</font></tt>
<br><tt><font size=2>@@ -787,34 +797,25 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
struct ib_qp_attr *attr,</font></tt>
<br><tt><font size=2>
int attr_mask, int smi_reset2init)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- enum ib_qp_state
qp_cur_state = 0, qp_new_state = 0;</font></tt>
<br><tt><font size=2>- int cnt = 0,
qp_attr_idx = 0, ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+ enum ib_qp_state
qp_cur_state, qp_new_state;</font></tt>
<br><tt><font size=2>+ int cnt, qp_attr_idx,
ret = 0;</font></tt>
<br><tt><font size=2> enum ib_qp_statetrans
statetrans;</font></tt>
<br><tt><font size=2>- struct hcp_modify_qp_control_block
*mqpcb = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- u64 update_mask
= 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ struct hcp_modify_qp_control_block
*mqpcb;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(ibqp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca =</font></tt>
<br><tt><font size=2>+
container_of(ibqp->pd->device, struct ehca_shca,
ib_device);</font></tt>
<br><tt><font size=2>+ u64 update_mask;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> int bad_wqe_cnt
= 0;</font></tt>
<br><tt><font size=2> int squeue_locked
= 0;</font></tt>
<br><tt><font size=2> unsigned
long spl_flags = 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- my_qp = container_of(ibqp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>- shca = container_of(ibqp->pd->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x ibqp_type=%x "</font></tt>
<br><tt><font size=2>-
"new qp_state=%x attribute_mask=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, ibqp->qp_type,</font></tt>
<br><tt><font size=2>-
attr->qp_state, attr_mask);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /* do query_qp
to obtain current attr values */</font></tt>
<br><tt><font size=2> mqpcb =
kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (mqpcb
== NULL) {</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not get zeroed page for mqpcb
"</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "Could not get zeroed
page for mqpcb "</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x ", my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>-
goto modify_qp_exit0;</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_query_qp(shca->ipz_hca_handle,</font></tt>
<br><tt><font size=2>@@ -822,20 +823,18 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
&my_qp->pf,</font></tt>
<br><tt><font size=2>
mqpcb, my_qp->galpas.kernel);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_h_query_qp() failed "</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "hipz_h_query_qp()
failed "</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x h_ret=%lx",</font></tt>
<br><tt><font size=2>
my_qp,
ibqp->qp_num, h_ret);</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- EDEB(7, "ehca_qp=%p
qp_num=%x ehca_qp_state=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, mqpcb->qp_state);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> qp_cur_state
= ehca2ib_qp_state(mqpcb->qp_state);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (qp_cur_state
== -EINVAL) { /* invalid qp state */</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid current ehca_qp_state=%x
"</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "Invalid current ehca_qp_state=%x
"</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x",</font></tt>
<br><tt><font size=2>
mqpcb->qp_state,
my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2>@@ -860,37 +859,38 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
int smirc = internal_modify_qp(</font></tt>
<br><tt><font size=2>
ibqp, &smiqp_attr,
smiqp_attr_mask, 1);</font></tt>
<br><tt><font size=2>
if (smirc) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "SMI
RESET -> INIT failed. "</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"SMI RESET -> INIT failed. "</font></tt>
<br><tt><font size=2>
"ehca_modify_qp() rc=%x", smirc);</font></tt>
<br><tt><font size=2>
ret = H_PARAMETER;</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
qp_cur_state = IB_QPS_INIT;</font></tt>
<br><tt><font size=2>-
EDEB(7, "SMI RESET -> INIT succeeded");</font></tt>
<br><tt><font size=2>+
ehca_dbg(ibqp->device, "SMI RESET -> INIT
succeeded");</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> /* is transmitted
current state equal to "real" current state */</font></tt>
<br><tt><font size=2> if ((attr_mask
& IB_QP_CUR_STATE) &&</font></tt>
<br><tt><font size=2>
qp_cur_state != attr->cur_qp_state) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid IB_QP_CUR_STATE attr->curr_qp_state=%x
<>"</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,</font></tt>
<br><tt><font size=2>+
"Invalid
IB_QP_CUR_STATE attr->curr_qp_state=%x <>"</font></tt>
<br><tt><font size=2>
"
actual cur_qp_state=%x. ehca_qp=%p qp_num=%x",</font></tt>
<br><tt><font size=2>
attr->cur_qp_state,
qp_cur_state, my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7,
"ehca_qp=%p qp_num=%x current qp_state=%x
"</font></tt>
<br><tt><font size=2>-
"new qp_state=%x attribute_mask=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, qp_cur_state, attr->qp_state, attr_mask);</font></tt>
<br><tt><font size=2>+ ehca_dbg(ibqp->device,"ehca_qp=%p
qp_num=%x current qp_state=%x "</font></tt>
<br><tt><font size=2>+
"new qp_state=%x attribute_mask=%x",</font></tt>
<br><tt><font size=2>+
my_qp, ibqp->qp_num, qp_cur_state, attr->qp_state,
attr_mask);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> qp_new_state
= attr_mask & IB_QP_STATE ? attr->qp_state : qp_cur_state;</font></tt>
<br><tt><font size=2> if (!smi_reset2init
&&</font></tt>
<br><tt><font size=2>
!ib_modify_qp_is_ok(qp_cur_state, qp_new_state, ibqp->qp_type,</font></tt>
<br><tt><font size=2>
attr_mask)) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid qp transition new_state=%x
cur_state=%x "</font></tt>
<br><tt><font size=2>-
"ehca_qp=%p
qp_num=%x attr_mask=%x",</font></tt>
<br><tt><font size=2>-
qp_new_state,
qp_cur_state, my_qp, ibqp->qp_num,</font></tt>
<br><tt><font size=2>-
attr_mask);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,</font></tt>
<br><tt><font size=2>+
"Invalid
qp transition new_state=%x cur_state=%x "</font></tt>
<br><tt><font size=2>+
"ehca_qp=%p
qp_num=%x attr_mask=%x", qp_new_state,</font></tt>
<br><tt><font size=2>+
qp_cur_state,
my_qp, ibqp->qp_num, attr_mask);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -898,7 +898,7 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
update_mask = EHCA_BMASK_SET(MQPCB_MASK_QP_STATE,
1);</font></tt>
<br><tt><font size=2> else {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid new qp state=%x "</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "Invalid new qp state=%x
"</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x",</font></tt>
<br><tt><font size=2>
qp_new_state,
my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2>@@ -908,10 +908,9 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2> statetrans
= get_modqp_statetrans(qp_cur_state, qp_new_state);</font></tt>
<br><tt><font size=2> if (statetrans
< 0) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "<INVALID STATE CHANGE> qp_cur_state=%x
"</font></tt>
<br><tt><font size=2>-
"new_qp_state=%x
State_xsition=%x "</font></tt>
<br><tt><font size=2>-
"ehca_qp=%p
qp_num=%x",</font></tt>
<br><tt><font size=2>-
qp_cur_state,
qp_new_state,</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "<INVALID STATE
CHANGE> qp_cur_state=%x "</font></tt>
<br><tt><font size=2>+
"new_qp_state=%x
State_xsition=%x ehca_qp=%p "</font></tt>
<br><tt><font size=2>+
"qp_num=%x",
qp_cur_state, qp_new_state,</font></tt>
<br><tt><font size=2>
statetrans,
my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -920,13 +919,15 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (qp_attr_idx
< 0) {</font></tt>
<br><tt><font size=2>
ret = qp_attr_idx;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid QP type=%x ehca_qp=%p qp_num=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,</font></tt>
<br><tt><font size=2>+
"Invalid
QP type=%x ehca_qp=%p qp_num=%x",</font></tt>
<br><tt><font size=2>
ibqp->qp_type,
my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "ehca_qp=%p
qp_num=%x <VALID STATE CHANGE> qp_state_xsit=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, statetrans);</font></tt>
<br><tt><font size=2>+ ehca_dbg(ibqp->device,</font></tt>
<br><tt><font size=2>+
"ehca_qp=%p qp_num=%x <VALID STATE CHANGE>
qp_state_xsit=%x",</font></tt>
<br><tt><font size=2>+
my_qp, ibqp->qp_num, statetrans);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* sqe ->
rts: set purge bit of bad wqe before actual trans */</font></tt>
<br><tt><font size=2> if ((my_qp->qp_type
== IB_QPT_UD ||</font></tt>
<br><tt><font size=2>@@ -935,7 +936,7 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
statetrans == IB_QPST_SQE2RTS) {</font></tt>
<br><tt><font size=2>
/* mark next free wqe if kernel */</font></tt>
<br><tt><font size=2>
if (my_qp->uspace_squeue == 0) {</font></tt>
<br><tt><font size=2>-
struct ehca_wqe
*wqe = NULL;</font></tt>
<br><tt><font size=2>+
struct ehca_wqe
*wqe;</font></tt>
<br><tt><font size=2>
/* lock
send queue */</font></tt>
<br><tt><font size=2>
spin_lock_irqsave(&my_qp->spinlock_s,
spl_flags);</font></tt>
<br><tt><font size=2>
squeue_locked
= 1;</font></tt>
<br><tt><font size=2>@@ -943,12 +944,12 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
wqe = (struct
ehca_wqe*)</font></tt>
<br><tt><font size=2>
ipz_qeit_get(&my_qp->ipz_squeue);</font></tt>
<br><tt><font size=2>
wqe->optype
= wqe->wqef = 0xff;</font></tt>
<br><tt><font size=2>-
EDEB(7, "qp_num=%x
next_free_wqe=%p",</font></tt>
<br><tt><font size=2>-
ibqp->qp_num, wqe);</font></tt>
<br><tt><font size=2>+
ehca_dbg(ibqp->device,
"qp_num=%x next_free_wqe=%p",</font></tt>
<br><tt><font size=2>+
ibqp->qp_num, wqe);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
ret = prepare_sqe_rts(my_qp, shca, &bad_wqe_cnt);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "prepare_sqe_rts()
failed "</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"prepare_sqe_rts() failed "</font></tt>
<br><tt><font size=2>
"ehca_qp=%p qp_num=%x ret=%x",</font></tt>
<br><tt><font size=2>
my_qp, ibqp->qp_num, ret);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit2;</font></tt>
<br><tt><font size=2>@@ -977,14 +978,11 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_PKEY_INDEX) {</font></tt>
<br><tt><font size=2>
mqpcb->prim_p_key_idx = attr->pkey_index;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_PRIM_P_KEY_IDX,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"IB_QP_PKEY_INDEX update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_PORT) {</font></tt>
<br><tt><font size=2>
if (attr->port_num < 1 || attr->port_num
> shca->num_ports) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
port=%x. "</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"Invalid port=%x. "</font></tt>
<br><tt><font size=2>
"ehca_qp=%p qp_num=%x num_ports=%x",</font></tt>
<br><tt><font size=2>
attr->port_num, my_qp, ibqp->qp_num,</font></tt>
<br><tt><font size=2>
shca->num_ports);</font></tt>
<br><tt><font size=2>@@ -992,14 +990,10 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
mqpcb->prim_phys_port = attr->port_num;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_PRIM_PHYS_PORT,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_PORT update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_QKEY) {</font></tt>
<br><tt><font size=2>
mqpcb->qkey = attr->qkey;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_QKEY update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_AV) {</font></tt>
<br><tt><font size=2>
int ah_mult = ib_rate_to_mult(attr->ah_attr.static_rate);</font></tt>
<br><tt><font size=2>@@ -1013,18 +1007,12 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
mqpcb->service_level = attr->ah_attr.sl;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL,
1);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
if (ah_mult < ehca_mult)</font></tt>
<br><tt><font size=2>+
if (ah_mult < ehca_mult)</font></tt>
<br><tt><font size=2>
mqpcb->max_static_rate
= (ah_mult > 0) ?</font></tt>
<br><tt><font size=2>
((ehca_mult
- 1) / ah_mult) : 0;</font></tt>
<br><tt><font size=2>
else</font></tt>
<br><tt><font size=2>
mqpcb->max_static_rate
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(7, " ipd=mqpcb->max_static_rate set %x
"</font></tt>
<br><tt><font size=2>-
" ah_mult=%x
ehca_mult=%x "</font></tt>
<br><tt><font size=2>-
" attr->ah_attr.static_rate=%x",</font></tt>
<br><tt><font size=2>-
mqpcb->max_static_rate,ah_mult,ehca_mult,</font></tt>
<br><tt><font size=2>-
attr->ah_attr.static_rate);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE,
1);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
/*</font></tt>
<br><tt><font size=2>@@ -1052,48 +1040,33 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
update_mask
|=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(MQPCB_MASK_TRAFFIC_CLASS, 1);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_AV update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_PATH_MTU) {</font></tt>
<br><tt><font size=2>
mqpcb->path_mtu = attr->path_mtu;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_PATH_MTU,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_PATH_MTU
update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_TIMEOUT) {</font></tt>
<br><tt><font size=2>
mqpcb->timeout = attr->timeout;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_TIMEOUT,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_TIMEOUT update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_RETRY_CNT) {</font></tt>
<br><tt><font size=2>
mqpcb->retry_count = attr->retry_cnt;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_RETRY_COUNT,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_RETRY_CNT
update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_RNR_RETRY) {</font></tt>
<br><tt><font size=2>
mqpcb->rnr_retry_count = attr->rnr_retry;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_RNR_RETRY_COUNT,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_RNR_RETRY
update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_RQ_PSN) {</font></tt>
<br><tt><font size=2>
mqpcb->receive_psn = attr->rq_psn;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_RECEIVE_PSN,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_RQ_PSN update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_MAX_DEST_RD_ATOMIC) {</font></tt>
<br><tt><font size=2>
mqpcb->rdma_nr_atomic_resp_res = attr->max_dest_rd_atomic
< 3 ?</font></tt>
<br><tt><font size=2>-
attr->max_dest_rd_atomic
: 2; /* max is 2 */</font></tt>
<br><tt><font size=2>+
attr->max_dest_rd_atomic
: 2;</font></tt>
<br><tt><font size=2>
update_mask |=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(MQPCB_MASK_RDMA_NR_ATOMIC_RESP_RES,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_MAX_DEST_RD_ATOMIC
"</font></tt>
<br><tt><font size=2>-
"update_mask=%lx", my_qp,
ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_MAX_QP_RD_ATOMIC) {</font></tt>
<br><tt><font size=2>
mqpcb->rdma_atomic_outst_dest_qp = attr->max_rd_atomic
< 3 ?</font></tt>
<br><tt><font size=2>@@ -1101,8 +1074,6 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
update_mask |=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET</font></tt>
<br><tt><font size=2>
(MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_MAX_QP_RD_ATOMIC
"</font></tt>
<br><tt><font size=2>-
"update_mask=%lx", my_qp,
ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_ALT_PATH) {</font></tt>
<br><tt><font size=2>
int ah_mult = ib_rate_to_mult(attr->alt_ah_attr.static_rate);</font></tt>
<br><tt><font size=2>@@ -1123,10 +1094,6 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
else</font></tt>
<br><tt><font size=2>
mqpcb->max_static_rate_al
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(7, " ipd=mqpcb->max_static_rate set %x,"</font></tt>
<br><tt><font size=2>-
" ah_mult=%x
ehca_mult=%x",</font></tt>
<br><tt><font size=2>-
mqpcb->max_static_rate,ah_mult,ehca_mult);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE_AL,
1);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
/*</font></tt>
<br><tt><font size=2>@@ -1159,43 +1126,28 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
update_mask
|=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(MQPCB_MASK_TRAFFIC_CLASS_AL,
1);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x IB_QP_ALT_PATH
update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_MIN_RNR_TIMER) {</font></tt>
<br><tt><font size=2>
mqpcb->min_rnr_nak_timer_field = attr->min_rnr_timer;</font></tt>
<br><tt><font size=2>
update_mask |=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(MQPCB_MASK_MIN_RNR_NAK_TIMER_FIELD,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"IB_QP_MIN_RNR_TIMER update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_SQ_PSN) {</font></tt>
<br><tt><font size=2>
mqpcb->send_psn = attr->sq_psn;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SEND_PSN,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"IB_QP_SQ_PSN update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_DEST_QPN) {</font></tt>
<br><tt><font size=2>
mqpcb->dest_qp_nr = attr->dest_qp_num;</font></tt>
<br><tt><font size=2>
update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DEST_QP_NR,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"IB_QP_DEST_QPN update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_PATH_MIG_STATE) {</font></tt>
<br><tt><font size=2>
mqpcb->path_migration_state = attr->path_mig_state;</font></tt>
<br><tt><font size=2>
update_mask |=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(MQPCB_MASK_PATH_MIGRATION_STATE,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"IB_QP_PATH_MIG_STATE update_mask=%lx",
my_qp,</font></tt>
<br><tt><font size=2>-
ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (attr_mask
& IB_QP_CAP) {</font></tt>
<br><tt><font size=2>@@ -1205,13 +1157,11 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
mqpcb->max_nr_outst_recv_wr = attr->cap.max_recv_wr+1;</font></tt>
<br><tt><font size=2>
update_mask |=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(MQPCB_MASK_MAX_NR_OUTST_RECV_WR,
1);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"IB_QP_CAP update_mask=%lx",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2>
/* no support for max_send/recv_sge yet */</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_DMP(7, mqpcb,
4*70, "ehca_qp=%p qp_num=%x", my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(mqpcb, 4*70, "qp_num=%x", ibqp->qp_num);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_modify_qp(shca->ipz_hca_handle,</font></tt>
<br><tt><font size=2>
my_qp->ipz_qp_handle,</font></tt>
<br><tt><font size=2>@@ -1221,9 +1171,8 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_h_modify_qp() failed rc=%lx
"</font></tt>
<br><tt><font size=2>-
"ehca_qp=%p
qp_num=%x",</font></tt>
<br><tt><font size=2>-
h_ret, my_qp,
ibqp->qp_num);</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "hipz_h_modify_qp()
failed rc=%lx "</font></tt>
<br><tt><font size=2>+
"ehca_qp=%p
qp_num=%x",h_ret, my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit2;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1234,7 +1183,7 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
/* doorbell to reprocessing wqes */</font></tt>
<br><tt><font size=2>
iosync(); /* serialize GAL register access
*/</font></tt>
<br><tt><font size=2>
hipz_update_sqa(my_qp, bad_wqe_cnt-1);</font></tt>
<br><tt><font size=2>-
EDEB(6, "doorbell for %x wqes", bad_wqe_cnt);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("doorbell for %x wqes", bad_wqe_cnt);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (statetrans
== IB_QPST_RESET2INIT ||</font></tt>
<br><tt><font size=2>@@ -1244,10 +1193,6 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2>
update_mask = 0;</font></tt>
<br><tt><font size=2>
update_mask = EHCA_BMASK_SET(MQPCB_MASK_QP_ENABLE,
1);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x "</font></tt>
<br><tt><font size=2>-
"RESET_2_INIT needs an additional
enable "</font></tt>
<br><tt><font size=2>-
"-> update_mask=%lx",
my_qp, ibqp->qp_num, update_mask);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>
h_ret = hipz_h_modify_qp(shca->ipz_hca_handle,</font></tt>
<br><tt><font size=2>
my_qp->ipz_qp_handle,</font></tt>
<br><tt><font size=2>
&my_qp->pf,</font></tt>
<br><tt><font size=2>@@ -1257,10 +1202,9 @@ static int internal_modify_qp(struct
ib_</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (h_ret != H_SUCCESS) {</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "ENABLE
in context of "</font></tt>
<br><tt><font size=2>-
"RESET_2_INIT failed! "</font></tt>
<br><tt><font size=2>-
"Maybe you didn't get a LID"</font></tt>
<br><tt><font size=2>-
"h_ret=%lx ehca_qp=%p qp_num=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"ENABLE in context of "</font></tt>
<br><tt><font size=2>+
"RESET_2_INIT failed! Maybe you didn't get "</font></tt>
<br><tt><font size=2>+
"a LID h_ret=%lx ehca_qp=%p qp_num=%x",</font></tt>
<br><tt><font size=2>
h_ret, my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>
goto modify_qp_exit2;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -1283,91 +1227,60 @@ modify_qp_exit2:</font></tt>
<br><tt><font size=2> modify_qp_exit1:</font></tt>
<br><tt><font size=2> kfree(mqpcb);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-modify_qp_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x ibqp_type=%x ret=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, ibqp->qp_type, ret);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_modify_qp(struct ib_qp *ibqp, struct
ib_qp_attr *attr, int attr_mask)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(ibqp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,</font></tt>
<br><tt><font size=2>+
ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ibqp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(attr);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ibqp->device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_qp = container_of(ibqp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x ibqp_type=%x attr_mask=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, ibqp->qp_type, attr_mask);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_pd = container_of(my_qp->ib_qp.pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->pd->device, "Invalid caller
pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>- } else</font></tt>
<br><tt><font size=2>-
ret = internal_modify_qp(ibqp, attr, attr_mask, 0);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>+ }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x ibqp_type=%x ret=%x",</font></tt>
<br><tt><font size=2>-
my_qp, ibqp->qp_num, ibqp->qp_type, ret);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return internal_modify_qp(ibqp,
attr, attr_mask, 0);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_query_qp(struct ib_qp *qp,</font></tt>
<br><tt><font size=2>
struct ib_qp_attr *qp_attr,</font></tt>
<br><tt><font size=2>
int qp_attr_mask, struct ib_qp_init_attr
*qp_init_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct hcp_modify_qp_control_block
*qpcb = NULL;</font></tt>
<br><tt><font size=2>- struct ipz_adapter_handle
adapter_handle;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(qp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,</font></tt>
<br><tt><font size=2>+
ib_pd);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(qp->device, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2>+ struct ipz_adapter_handle
adapter_handle = shca->ipz_hca_handle;</font></tt>
<br><tt><font size=2>+ struct hcp_modify_qp_control_block
*qpcb;</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2>- int cnt = 0,
ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ int cnt, ret
= 0;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(qp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(qp_attr);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_DEVICE(qp->device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_qp = container_of(qp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x "</font></tt>
<br><tt><font size=2>-
"qp_attr=%p qp_attr_mask=%x qp_init_attr=%p",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, qp_attr, qp_attr_mask, qp_init_attr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_pd = container_of(my_qp->ib_qp.pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto query_qp_exit0;</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- shca = container_of(qp->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>- adapter_handle
= shca->ipz_hca_handle;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (qp_attr_mask
& QP_ATTR_QUERY_NOT_SUPPORTED) {</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"Invalid attribute mask "</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device,"Invalid attribute mask
"</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x qp_attr_mask=%x ",</font></tt>
<br><tt><font size=2>
my_qp,
qp->qp_num, qp_attr_mask);</font></tt>
<br><tt><font size=2>-
goto query_qp_exit0;</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> qpcb = kzalloc(H_CB_ALIGNMENT,
GFP_KERNEL );</font></tt>
<br><tt><font size=2> if (!qpcb)
{</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"Out of memory for qpcb "</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device,"Out of memory for qpcb
"</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x", my_qp, qp->qp_num);</font></tt>
<br><tt><font size=2>-
goto query_qp_exit0;</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_query_qp(adapter_handle,</font></tt>
<br><tt><font size=2>@@ -1377,7 +1290,7 @@ int ehca_query_qp(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>
ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"hipz_h_query_qp() failed "</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device,"hipz_h_query_qp() failed
"</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x h_ret=%lx",</font></tt>
<br><tt><font size=2>
my_qp,
qp->qp_num, h_ret);</font></tt>
<br><tt><font size=2>
goto query_qp_exit1;</font></tt>
<br><tt><font size=2>@@ -1385,9 +1298,10 @@ int ehca_query_qp(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> qp_attr->cur_qp_state
= ehca2ib_qp_state(qpcb->qp_state);</font></tt>
<br><tt><font size=2> qp_attr->qp_state
= qp_attr->cur_qp_state;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> if (qp_attr->cur_qp_state
== -EINVAL) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4,"Got invalid ehca_qp_state=%x "</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device,"Got invalid ehca_qp_state=%x
"</font></tt>
<br><tt><font size=2>
"ehca_qp=%p
qp_num=%x",</font></tt>
<br><tt><font size=2>
qpcb->qp_state,
my_qp, qp->qp_num);</font></tt>
<br><tt><font size=2>
goto query_qp_exit1;</font></tt>
<br><tt><font size=2>@@ -1482,54 +1396,33 @@ int ehca_query_qp(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2> if (qp_init_attr)</font></tt>
<br><tt><font size=2>
*qp_init_attr = my_qp->init_attr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7,
"ehca_qp=%p qp_number=%x dest_qp_number=%x
"</font></tt>
<br><tt><font size=2>-
"dlid=%x path_mtu=%x dest_gid=%lx_%lx "</font></tt>
<br><tt><font size=2>-
"service_level=%x qp_state=%x",</font></tt>
<br><tt><font size=2>-
my_qp, qpcb->qp_number, qpcb->dest_qp_nr,</font></tt>
<br><tt><font size=2>-
qpcb->dlid, qpcb->path_mtu,</font></tt>
<br><tt><font size=2>-
qpcb->dest_gid.dw[0], qpcb->dest_gid.dw[1],</font></tt>
<br><tt><font size=2>-
qpcb->service_level, qpcb->qp_state);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_DMP(7, qpcb,
4*70, "ehca_qp=%p qp_num=%x", my_qp, qp->qp_num);</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(qpcb, 4*70, "qp_num=%x", qp->qp_num);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> query_qp_exit1:</font></tt>
<br><tt><font size=2> kfree(qpcb);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-query_qp_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x ret=%x",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, ret);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_destroy_qp(struct ib_qp *ibqp)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- extern struct
ehca_module ehca_module;</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_shca
*shca = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pfqp
*qp_pf = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_pd
*my_pd = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(ibqp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ehca_shca
*shca = container_of(ibqp->device, struct ehca_shca,</font></tt>
<br><tt><font size=2>+
ib_device);</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,</font></tt>
<br><tt><font size=2>+
ib_pd);</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2>- u32 qp_num =
0;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>- u64 h_ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u8 port_num =
0;</font></tt>
<br><tt><font size=2>+ u32 qp_num =
ibqp->qp_num;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2>+ u64 h_ret;</font></tt>
<br><tt><font size=2>+ u8 port_num;</font></tt>
<br><tt><font size=2> enum ib_qp_type
qp_type;</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(ibqp);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_qp = container_of(ibqp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>- qp_num = ibqp->qp_num;</font></tt>
<br><tt><font size=2>- qp_pf = &my_qp->pf;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- shca = container_of(ibqp->device,
struct ehca_shca, ib_device);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x", my_qp, ibqp->qp_num);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_pd = container_of(my_qp->ib_qp.pd,
struct ehca_pd, ib_pd);</font></tt>
<br><tt><font size=2> if (my_pd->ib_pd.uobject
&& my_pd->ib_pd.uobject->context &&</font></tt>
<br><tt><font size=2>
my_pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "Invalid caller pid=%x
ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid,
my_pd->ownpid);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1538,11 +1431,10 @@ int ehca_destroy_qp(struct
ib_qp *ibqp)</font></tt>
<br><tt><font size=2>
ret = ehca_cq_unassign_qp(my_qp->send_cq,</font></tt>
<br><tt><font size=2>
my_qp->real_qp_num);</font></tt>
<br><tt><font size=2>
if (ret) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Couldn't
unassign qp from send_cq "</font></tt>
<br><tt><font size=2>-
"ret=%x qp_num=%x cq_num=%x",</font></tt>
<br><tt><font size=2>-
ret, my_qp->ib_qp.qp_num,</font></tt>
<br><tt><font size=2>-
my_qp->send_cq->cq_number);</font></tt>
<br><tt><font size=2>-
goto destroy_qp_exit0;</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"Couldn't unassign qp from "</font></tt>
<br><tt><font size=2>+
"send_cq ret=%x qp_num=%x cq_num=%x", ret,</font></tt>
<br><tt><font size=2>+
my_qp->ib_qp.qp_num, my_qp->send_cq->cq_number);</font></tt>
<br><tt><font size=2>+
return ret;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1554,17 +1446,25 @@ int ehca_destroy_qp(struct
ib_qp *ibqp)</font></tt>
<br><tt><font size=2> if (my_qp->uspace_rqueue)
{</font></tt>
<br><tt><font size=2>
ret = ehca_munmap(my_qp->uspace_rqueue,</font></tt>
<br><tt><font size=2>
my_qp->ipz_rqueue.queue_length);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"Could not munmap rqueue "</font></tt>
<br><tt><font size=2>+
"qp_num=%x", qp_num);</font></tt>
<br><tt><font size=2>
ret = ehca_munmap(my_qp->uspace_squeue,</font></tt>
<br><tt><font size=2>
my_qp->ipz_squeue.queue_length);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"Could not munmap squeue "</font></tt>
<br><tt><font size=2>+
"qp_num=%x", qp_num);</font></tt>
<br><tt><font size=2>
ret = ehca_munmap(my_qp->uspace_fwh, EHCA_PAGESIZE);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device,
"Could not munmap fwh qp_num=%x",</font></tt>
<br><tt><font size=2>+
qp_num);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> h_ret =
hipz_h_destroy_qp(shca->ipz_hca_handle, my_qp);</font></tt>
<br><tt><font size=2> if (h_ret
!= H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "hipz_h_destroy_qp() failed "</font></tt>
<br><tt><font size=2>-
"rc=%lx
ehca_qp=%p qp_num=%x",</font></tt>
<br><tt><font size=2>-
h_ret, qp_pf,
qp_num);</font></tt>
<br><tt><font size=2>-
goto destroy_qp_exit0;</font></tt>
<br><tt><font size=2>+
ehca_err(ibqp->device, "hipz_h_destroy_qp()
failed rc=%lx "</font></tt>
<br><tt><font size=2>+
"ehca_qp=%p
qp_num=%x", h_ret, my_qp, qp_num);</font></tt>
<br><tt><font size=2>+
return ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> port_num
= my_qp->init_attr.port_num;</font></tt>
<br><tt><font size=2>@@ -1573,9 +1473,8 @@ int ehca_destroy_qp(struct ib_qp
*ibqp)</font></tt>
<br><tt><font size=2> /* no support
for IB_QPT_SMI yet */</font></tt>
<br><tt><font size=2> if (qp_type
== IB_QPT_GSI) {</font></tt>
<br><tt><font size=2>
struct ib_event event;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-
EDEB(4, "device %s: port %x is inactive.",</font></tt>
<br><tt><font size=2>-
shca->ib_device.name, port_num);</font></tt>
<br><tt><font size=2>+
ehca_info(ibqp->device, "device %s: port %x
is inactive.",</font></tt>
<br><tt><font size=2>+
shca->ib_device.name,
port_num);</font></tt>
<br><tt><font size=2>
event.device = &shca->ib_device;</font></tt>
<br><tt><font size=2>
event.event = IB_EVENT_PORT_ERR;</font></tt>
<br><tt><font size=2>
event.element.port_num = port_num;</font></tt>
<br><tt><font size=2>@@ -1585,10 +1484,23 @@ int ehca_destroy_qp(struct
ib_qp *ibqp)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ipz_queue_dtor(&my_qp->ipz_rqueue);</font></tt>
<br><tt><font size=2> ipz_queue_dtor(&my_qp->ipz_squeue);</font></tt>
<br><tt><font size=2>- kmem_cache_free(ehca_module.cache_qp,
my_qp);</font></tt>
<br><tt><font size=2>+ kmem_cache_free(qp_cache,
my_qp);</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-destroy_qp_exit0:</font></tt>
<br><tt><font size=2>- ret = ehca2ib_return_code(h_ret);</font></tt>
<br><tt><font size=2>- EDEB_EX(7,"ret=%x",
ret);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+int ehca_init_qp_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ qp_cache = kmem_cache_create("ehca_cache_qp",</font></tt>
<br><tt><font size=2>+
sizeof(struct ehca_qp), 0,</font></tt>
<br><tt><font size=2>+
SLAB_HWCACHE_ALIGN,</font></tt>
<br><tt><font size=2>+
NULL, NULL);</font></tt>
<br><tt><font size=2>+ if (!qp_cache)</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2>+}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+void ehca_cleanup_qp_cache(void)</font></tt>
<br><tt><font size=2>+{</font></tt>
<br><tt><font size=2>+ if (qp_cache)</font></tt>
<br><tt><font size=2>+
kmem_cache_destroy(qp_cache);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_reqs.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_reqs.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_reqs.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_reqs.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -41,8 +41,6 @@</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "reqs"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm-powerpc/system.h></font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2>@@ -58,7 +56,7 @@ static inline int ehca_write_rwqe(struct</font></tt>
<br><tt><font size=2> u8 cnt_ds;</font></tt>
<br><tt><font size=2> if (unlikely((recv_wr->num_sge
< 0) ||</font></tt>
<br><tt><font size=2>
(recv_wr->num_sge > ipz_rqueue->act_nr_of_sg)))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid number of WQE SGE. "</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid number of WQE SGE. "</font></tt>
<br><tt><font size=2>
"num_sqe=%x
max_nr_of_sg=%x",</font></tt>
<br><tt><font size=2>
recv_wr->num_sge,
ipz_rqueue->act_nr_of_sg);</font></tt>
<br><tt><font size=2>
return -EINVAL; /* invalid SG list length */</font></tt>
<br><tt><font size=2>@@ -79,9 +77,9 @@ static inline int ehca_write_rwqe(struct</font></tt>
<br><tt><font size=2>
recv_wr->sg_list[cnt_ds].length;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (IS_EDEB_ON(7))
{</font></tt>
<br><tt><font size=2>-
EDEB(7, "RECEIVE WQE written into ipz_rqueue=%p",
ipz_rqueue);</font></tt>
<br><tt><font size=2>-
EDEB_DMP(7, wqe_p, 16*(6 + wqe_p->nr_of_data_seg),
"recv wqe");</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)
{</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("RECEIVE WQE written into ipz_rqueue=%p",
ipz_rqueue);</font></tt>
<br><tt><font size=2>+
ehca_dmp( wqe_p, 16*(6 + wqe_p->nr_of_data_seg),
"recv wqe");</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2>@@ -94,31 +92,35 @@ static inline int ehca_write_rwqe(struct</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static void trace_send_wr_ud(const struct ib_send_wr
*send_wr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int idx = 0;</font></tt>
<br><tt><font size=2>- int j = 0;</font></tt>
<br><tt><font size=2>+ int idx;</font></tt>
<br><tt><font size=2>+ int j;</font></tt>
<br><tt><font size=2> while (send_wr)
{</font></tt>
<br><tt><font size=2>
struct ib_mad_hdr *mad_hdr = send_wr->wr.ud.mad_hdr;</font></tt>
<br><tt><font size=2>
struct ib_sge *sge = send_wr->sg_list;</font></tt>
<br><tt><font size=2>-
EDEB(4, "send_wr#%x wr_id=%lx num_sge=%x "</font></tt>
<br><tt><font size=2>-
"send_flags=%x opcode=%x",idx,
send_wr->wr_id,</font></tt>
<br><tt><font size=2>-
send_wr->num_sge, send_wr->send_flags,
send_wr->opcode);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("send_wr#%x wr_id=%lx num_sge=%x
"</font></tt>
<br><tt><font size=2>+
"send_flags=%x opcode=%x",idx, send_wr->wr_id,</font></tt>
<br><tt><font size=2>+
send_wr->num_sge, send_wr->send_flags,</font></tt>
<br><tt><font size=2>+
send_wr->opcode);</font></tt>
<br><tt><font size=2>
if (mad_hdr) {</font></tt>
<br><tt><font size=2>-
EDEB(4, "send_wr#%x
mad_hdr base_version=%x "</font></tt>
<br><tt><font size=2>-
"mgmt_class=%x class_version=%x method=%x "</font></tt>
<br><tt><font size=2>-
"status=%x class_specific=%x tid=%lx attr_id=%x "</font></tt>
<br><tt><font size=2>-
"resv=%x attr_mod=%x",</font></tt>
<br><tt><font size=2>-
idx, mad_hdr->base_version, mad_hdr->mgmt_class,</font></tt>
<br><tt><font size=2>-
mad_hdr->class_version, mad_hdr->method,</font></tt>
<br><tt><font size=2>-
mad_hdr->status, mad_hdr->class_specific,</font></tt>
<br><tt><font size=2>-
mad_hdr->tid, mad_hdr->attr_id, mad_hdr->resv,</font></tt>
<br><tt><font size=2>-
mad_hdr->attr_mod);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("send_wr#%x
mad_hdr base_version=%x "</font></tt>
<br><tt><font size=2>+
"mgmt_class=%x class_version=%x
method=%x "</font></tt>
<br><tt><font size=2>+
"status=%x class_specific=%x tid=%lx
"</font></tt>
<br><tt><font size=2>+
"attr_id=%x resv=%x attr_mod=%x",</font></tt>
<br><tt><font size=2>+
idx, mad_hdr->base_version,</font></tt>
<br><tt><font size=2>+
mad_hdr->mgmt_class,</font></tt>
<br><tt><font size=2>+
mad_hdr->class_version, mad_hdr->method,</font></tt>
<br><tt><font size=2>+
mad_hdr->status, mad_hdr->class_specific,</font></tt>
<br><tt><font size=2>+
mad_hdr->tid, mad_hdr->attr_id,</font></tt>
<br><tt><font size=2>+
mad_hdr->resv,</font></tt>
<br><tt><font size=2>+
mad_hdr->attr_mod);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
for (j = 0; j < send_wr->num_sge; j++)
{</font></tt>
<br><tt><font size=2>
u8 *data
= (u8 *) abs_to_virt(sge->addr);</font></tt>
<br><tt><font size=2>-
EDEB(4, "send_wr#%x
sge#%x addr=%p length=%x lkey=%x",</font></tt>
<br><tt><font size=2>-
idx, j, data, sge->length, sge->lkey);</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("send_wr#%x
sge#%x addr=%p length=%x "</font></tt>
<br><tt><font size=2>+
"lkey=%x",</font></tt>
<br><tt><font size=2>+
idx, j, data, sge->length, sge->lkey);</font></tt>
<br><tt><font size=2>
/* assume
length is n*16 */</font></tt>
<br><tt><font size=2>-
EDEB_DMP(4, data,
sge->length, "send_wr#%x sge#%x",</font></tt>
<br><tt><font size=2>+
ehca_dmp(data,
sge->length, "send_wr#%x sge#%x",</font></tt>
<br><tt><font size=2>
idx, j);</font></tt>
<br><tt><font size=2>
sge++;</font></tt>
<br><tt><font size=2>
} /* eof for j */</font></tt>
<br><tt><font size=2>@@ -140,7 +142,7 @@ static inline int ehca_write_swqe(struct</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (unlikely((send_wr->num_sge
< 0) ||</font></tt>
<br><tt><font size=2>
(send_wr->num_sge > qp->ipz_squeue.act_nr_of_sg)))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid number of WQE SGE. "</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid number of WQE SGE. "</font></tt>
<br><tt><font size=2>
"num_sqe=%x
max_nr_of_sg=%x",</font></tt>
<br><tt><font size=2>
send_wr->num_sge,
qp->ipz_squeue.act_nr_of_sg);</font></tt>
<br><tt><font size=2>
return -EINVAL; /* invalid SG list length */</font></tt>
<br><tt><font size=2>@@ -164,7 +166,7 @@ static inline int ehca_write_swqe(struct</font></tt>
<br><tt><font size=2>
wqe_p->optype = WQE_OPTYPE_RDMAREAD;</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid opcode=%x", send_wr->opcode);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid opcode=%x", send_wr->opcode);</font></tt>
<br><tt><font size=2>
return -EINVAL; /* invalid opcode */</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -196,7 +198,7 @@ static inline int ehca_write_swqe(struct</font></tt>
<br><tt><font size=2>
wqe_p->destination_qp_number = send_wr->wr.ud.remote_qpn
<< 8;</font></tt>
<br><tt><font size=2>
wqe_p->local_ee_context_qkey = remote_qkey;</font></tt>
<br><tt><font size=2>
if (!send_wr->wr.ud.ah) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "wr.ud.ah
is NULL. qp=%p", qp);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("wr.ud.ah
is NULL. qp=%p", qp);</font></tt>
<br><tt><font size=2>
return
-EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
my_av = container_of(send_wr->wr.ud.ah,
struct ehca_av, ib_ah);</font></tt>
<br><tt><font size=2>@@ -254,13 +256,13 @@ static inline int ehca_write_swqe(struct</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid qptype=%x", qp->qp_type);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid qptype=%x", qp->qp_type);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (IS_EDEB_ON(7))
{</font></tt>
<br><tt><font size=2>-
EDEB(7, "SEND WQE written into queue qp=%p ",
qp);</font></tt>
<br><tt><font size=2>-
EDEB_DMP(7, wqe_p, 16*(6 + wqe_p->nr_of_data_seg),
"send wqe");</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)
{</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("SEND WQE written into queue qp=%p
", qp);</font></tt>
<br><tt><font size=2>+
ehca_dmp( wqe_p, 16*(6 + wqe_p->nr_of_data_seg),
"send wqe");</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -355,19 +357,12 @@ int ehca_post_send(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
struct ib_send_wr *send_wr,</font></tt>
<br><tt><font size=2>
struct ib_send_wr **bad_send_wr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ib_send_wr
*cur_send_wr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_wqe
*wqe_p = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(qp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ib_send_wr
*cur_send_wr;</font></tt>
<br><tt><font size=2>+ struct ehca_wqe
*wqe_p;</font></tt>
<br><tt><font size=2> int wqe_cnt
= 0;</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- unsigned long
spl_flags = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(qp);</font></tt>
<br><tt><font size=2>- my_qp = container_of(qp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_QP(my_qp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(send_wr);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x send_wr=%p bad_send_wr=%p",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, send_wr, bad_send_wr);</font></tt>
<br><tt><font size=2>+ unsigned long
spl_flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* LOCK
the QUEUE */</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&my_qp->spinlock_s,
spl_flags);</font></tt>
<br><tt><font size=2>@@ -384,8 +379,8 @@ int ehca_post_send(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
*bad_send_wr = cur_send_wr;</font></tt>
<br><tt><font size=2>
if (wqe_cnt
== 0) {</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Too many posted WQEs qp_num=%x",</font></tt>
<br><tt><font size=2>-
qp->qp_num);</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device, "Too many posted WQEs
"</font></tt>
<br><tt><font size=2>+
"qp_num=%x",
qp->qp_num);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
goto post_send_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>@@ -400,14 +395,14 @@ int ehca_post_send(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
*bad_send_wr
= cur_send_wr;</font></tt>
<br><tt><font size=2>
if (wqe_cnt
== 0) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not write WQE qp_num=%x",</font></tt>
<br><tt><font size=2>-
qp->qp_num);</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device, "Could not write WQE
"</font></tt>
<br><tt><font size=2>+
"qp_num=%x",
qp->qp_num);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
goto post_send_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
wqe_cnt++;</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x wqe_cnt=%d",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, wqe_cnt);</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->device, "ehca_qp=%p qp_num=%x
wqe_cnt=%d",</font></tt>
<br><tt><font size=2>+
my_qp, qp->qp_num,
wqe_cnt);</font></tt>
<br><tt><font size=2> } /* eof
for cur_send_wr */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> post_send_exit0:</font></tt>
<br><tt><font size=2>@@ -415,8 +410,6 @@ post_send_exit0:</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&my_qp->spinlock_s,
spl_flags);</font></tt>
<br><tt><font size=2> iosync();
/* serialize GAL register access */</font></tt>
<br><tt><font size=2> hipz_update_sqa(my_qp,
wqe_cnt);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x ret=%x wqe_cnt=%d",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, ret, wqe_cnt);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -424,19 +417,12 @@ int ehca_post_recv(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
struct ib_recv_wr *recv_wr,</font></tt>
<br><tt><font size=2>
struct ib_recv_wr **bad_recv_wr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_qp
*my_qp = NULL;</font></tt>
<br><tt><font size=2>- struct ib_recv_wr
*cur_recv_wr = NULL;</font></tt>
<br><tt><font size=2>- struct ehca_wqe
*wqe_p = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*my_qp = container_of(qp, struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>+ struct ib_recv_wr
*cur_recv_wr;</font></tt>
<br><tt><font size=2>+ struct ehca_wqe
*wqe_p;</font></tt>
<br><tt><font size=2> int wqe_cnt
= 0;</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- unsigned long
spl_flags = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(qp);</font></tt>
<br><tt><font size=2>- my_qp = container_of(qp,
struct ehca_qp, ib_qp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_QP(my_qp);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(recv_wr);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_qp=%p
qp_num=%x recv_wr=%p bad_recv_wr=%p",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, recv_wr, bad_recv_wr);</font></tt>
<br><tt><font size=2>+ unsigned long
spl_flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* LOCK
the QUEUE */</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&my_qp->spinlock_r,
spl_flags);</font></tt>
<br><tt><font size=2>@@ -453,14 +439,13 @@ int ehca_post_recv(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
*bad_recv_wr = cur_recv_wr;</font></tt>
<br><tt><font size=2>
if (wqe_cnt
== 0) {</font></tt>
<br><tt><font size=2>
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Too many posted WQEs qp_num=%x",</font></tt>
<br><tt><font size=2>-
qp->qp_num);</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device, "Too many posted WQEs
"</font></tt>
<br><tt><font size=2>+
"qp_num=%x",
qp->qp_num);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
goto post_recv_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
/* write a RECV WQE into the QUEUE */</font></tt>
<br><tt><font size=2>-
ret = ehca_write_rwqe(&my_qp->ipz_rqueue, wqe_p,</font></tt>
<br><tt><font size=2>-
cur_recv_wr);</font></tt>
<br><tt><font size=2>+
ret = ehca_write_rwqe(&my_qp->ipz_rqueue, wqe_p,
cur_recv_wr);</font></tt>
<br><tt><font size=2>
/*</font></tt>
<br><tt><font size=2>
* if something failed,</font></tt>
<br><tt><font size=2>
* reset the free entry pointer to the start
value</font></tt>
<br><tt><font size=2>@@ -470,13 +455,13 @@ int ehca_post_recv(struct ib_qp
*qp,</font></tt>
<br><tt><font size=2>
*bad_recv_wr
= cur_recv_wr;</font></tt>
<br><tt><font size=2>
if (wqe_cnt
== 0) {</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not write WQE qp_num=%x",</font></tt>
<br><tt><font size=2>-
qp->qp_num);</font></tt>
<br><tt><font size=2>+
ehca_err(qp->device, "Could not write WQE
"</font></tt>
<br><tt><font size=2>+
"qp_num=%x",
qp->qp_num);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
goto post_recv_exit0;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
wqe_cnt++;</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_qp=%p qp_num=%x wqe_cnt=%d",</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("ehca_qp=%p qp_num=%x wqe_cnt=%d",</font></tt>
<br><tt><font size=2>
my_qp, qp->qp_num, wqe_cnt);</font></tt>
<br><tt><font size=2> } /* eof
for cur_recv_wr */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -484,8 +469,6 @@ post_recv_exit0:</font></tt>
<br><tt><font size=2> spin_unlock_irqrestore(&my_qp->spinlock_r,
spl_flags);</font></tt>
<br><tt><font size=2> iosync();
/* serialize GAL register access */</font></tt>
<br><tt><font size=2> hipz_update_rqa(my_qp,
wqe_cnt);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_qp=%p
qp_num=%x ret=%x wqe_cnt=%d",</font></tt>
<br><tt><font size=2>-
my_qp, qp->qp_num, ret, wqe_cnt);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -510,18 +493,16 @@ static inline int ehca_poll_cq_one(struc</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2> struct ehca_cq
*my_cq = container_of(cq, struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>- struct ehca_cqe
*cqe = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_cqe
*cqe;</font></tt>
<br><tt><font size=2> int cqe_count
= 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_cq=%p
cq_num=%x wc=%p", my_cq, my_cq->cq_number, wc);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> poll_cq_one_read_cqe:</font></tt>
<br><tt><font size=2> cqe = (struct
ehca_cqe *)</font></tt>
<br><tt><font size=2>
ipz_qeit_get_inc_valid(&my_cq->ipz_queue);</font></tt>
<br><tt><font size=2> if (!cqe)
{</font></tt>
<br><tt><font size=2>
ret = -EAGAIN;</font></tt>
<br><tt><font size=2>-
EDEB(7, "Completion queue is empty ehca_cq=%p
cq_num=%x "</font></tt>
<br><tt><font size=2>-
"ret=%x", my_cq, my_cq->cq_number,
ret);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->device, "Completion queue is
empty ehca_cq=%p "</font></tt>
<br><tt><font size=2>+
"cq_num=%x
ret=%x", my_cq, my_cq->cq_number, ret);</font></tt>
<br><tt><font size=2>
goto poll_cq_one_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -531,13 +512,13 @@ poll_cq_one_read_cqe:</font></tt>
<br><tt><font size=2> cqe_count++;</font></tt>
<br><tt><font size=2> if (unlikely(cqe->status
& WC_STATUS_PURGE_BIT)) {</font></tt>
<br><tt><font size=2>
struct ehca_qp *qp=ehca_cq_get_qp(my_cq, cqe->local_qp_number);</font></tt>
<br><tt><font size=2>-
int purgeflag = 0;</font></tt>
<br><tt><font size=2>-
unsigned long spl_flags = 0;</font></tt>
<br><tt><font size=2>+
int purgeflag;</font></tt>
<br><tt><font size=2>+
unsigned long spl_flags;</font></tt>
<br><tt><font size=2>
if (!qp) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "cq_num=%x
qp_num=%x "</font></tt>
<br><tt><font size=2>+
ehca_err(cq->device,
"cq_num=%x qp_num=%x "</font></tt>
<br><tt><font size=2>
"could not find qp -> ignore cqe",</font></tt>
<br><tt><font size=2>
my_cq->cq_number, cqe->local_qp_number);</font></tt>
<br><tt><font size=2>-
EDEB_DMP(4, cqe,
64, "cq_num=%x qp_num=%x",</font></tt>
<br><tt><font size=2>+
ehca_dmp(cqe,
64, "cq_num=%x qp_num=%x",</font></tt>
<br><tt><font size=2>
my_cq->cq_number, cqe->local_qp_number);</font></tt>
<br><tt><font size=2>
/* ignore
this purged cqe */</font></tt>
<br><tt><font size=2>
goto poll_cq_one_read_cqe;</font></tt>
<br><tt><font size=2>@@ -547,10 +528,13 @@ poll_cq_one_read_cqe:</font></tt>
<br><tt><font size=2>
spin_unlock_irqrestore(&qp->spinlock_s,
spl_flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (purgeflag) {</font></tt>
<br><tt><font size=2>-
EDEB(6, "Got
CQE with purged bit qp_num=%x src_qp=%x",</font></tt>
<br><tt><font size=2>-
cqe->local_qp_number, cqe->remote_qp_number);</font></tt>
<br><tt><font size=2>-
EDEB_DMP(6, cqe,
64, "qp_num=%x src_qp=%x",</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->device,
"Got CQE with purged bit qp_num=%x "</font></tt>
<br><tt><font size=2>+
"src_qp=%x",</font></tt>
<br><tt><font size=2>
cqe->local_qp_number, cqe->remote_qp_number);</font></tt>
<br><tt><font size=2>+
if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(cqe, 64, "qp_num=%x src_qp=%x",</font></tt>
<br><tt><font size=2>+
cqe->local_qp_number,</font></tt>
<br><tt><font size=2>+
cqe->remote_qp_number);</font></tt>
<br><tt><font size=2>
/*</font></tt>
<br><tt><font size=2>
* ignore
this to avoid double cqes of bad wqe</font></tt>
<br><tt><font size=2>
* that
caused sqe and turn off purge flag</font></tt>
<br><tt><font size=2>@@ -561,13 +545,15 @@ poll_cq_one_read_cqe:</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* tracing
cqe */</font></tt>
<br><tt><font size=2>- if (IS_EDEB_ON(7))
{</font></tt>
<br><tt><font size=2>-
EDEB(7, "Received COMPLETION ehca_cq=%p cq_num=%x
-----",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>-
EDEB_DMP(7, cqe, 64, "ehca_cq=%p cq_num=%x",</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)
{</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->device,</font></tt>
<br><tt><font size=2>+
"Received
COMPLETION ehca_cq=%p cq_num=%x -----",</font></tt>
<br><tt><font size=2>+
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>+
ehca_dmp(cqe, 64, "ehca_cq=%p cq_num=%x",</font></tt>
<br><tt><font size=2>+
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->device,</font></tt>
<br><tt><font size=2>+
"ehca_cq=%p
cq_num=%x -------------------------",</font></tt>
<br><tt><font size=2>
my_cq,
my_cq->cq_number);</font></tt>
<br><tt><font size=2>-
EDEB(7, "ehca_cq=%p cq_num=%x -------------------------",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* we got
a completion! */</font></tt>
<br><tt><font size=2>@@ -576,11 +562,11 @@ poll_cq_one_read_cqe:</font></tt>
<br><tt><font size=2> /* eval
ib_wc_opcode */</font></tt>
<br><tt><font size=2> wc->opcode
= ib_wc_opcode[cqe->optype]-1;</font></tt>
<br><tt><font size=2> if (unlikely(wc->opcode
== -1)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid cqe->OPType=%x cqe->status=%x
"</font></tt>
<br><tt><font size=2>+
ehca_err(cq->device, "Invalid cqe->OPType=%x
cqe->status=%x "</font></tt>
<br><tt><font size=2>
"ehca_cq=%p
cq_num=%x",</font></tt>
<br><tt><font size=2>
cqe->optype,
cqe->status, my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>
/* dump cqe for other infos */</font></tt>
<br><tt><font size=2>-
EDEB_DMP(4, cqe, 64, "ehca_cq=%p cq_num=%x",</font></tt>
<br><tt><font size=2>+
ehca_dmp(cqe, 64, "ehca_cq=%p cq_num=%x",</font></tt>
<br><tt><font size=2>
my_cq,
my_cq->cq_number);</font></tt>
<br><tt><font size=2>
/* update also queue adder to throw away this
entry!!! */</font></tt>
<br><tt><font size=2>
goto poll_cq_one_exit0;</font></tt>
<br><tt><font size=2>@@ -604,49 +590,35 @@ poll_cq_one_read_cqe:</font></tt>
<br><tt><font size=2> wc->sl
= cqe->service_level;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (wc->status
!= IB_WC_SUCCESS)</font></tt>
<br><tt><font size=2>-
EDEB(6, "ehca_cq=%p cq_num=%x WARNING unsuccessful
cqe "</font></tt>
<br><tt><font size=2>-
"OPType=%x status=%x qp_num=%x
src_qp=%x wr_id=%lx cqe=%p",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, cqe->optype,
cqe->status,</font></tt>
<br><tt><font size=2>-
cqe->local_qp_number, cqe->remote_qp_number,</font></tt>
<br><tt><font size=2>-
cqe->work_request_id, cqe);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->device,</font></tt>
<br><tt><font size=2>+
"ehca_cq=%p
cq_num=%x WARNING unsuccessful cqe "</font></tt>
<br><tt><font size=2>+
"OPType=%x
status=%x qp_num=%x src_qp=%x wr_id=%lx "</font></tt>
<br><tt><font size=2>+
"cqe=%p",
my_cq, my_cq->cq_number, cqe->optype,</font></tt>
<br><tt><font size=2>+
cqe->status,
cqe->local_qp_number,</font></tt>
<br><tt><font size=2>+
cqe->remote_qp_number,
cqe->work_request_id, cqe);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> poll_cq_one_exit0:</font></tt>
<br><tt><font size=2> if (cqe_count
> 0)</font></tt>
<br><tt><font size=2>
hipz_update_feca(my_cq, cqe_count);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x
ehca_cq=%p cq_number=%x wc=%p "</font></tt>
<br><tt><font size=2>-
"status=%x opcode=%x qp_num=%x byte_len=%x",</font></tt>
<br><tt><font size=2>-
ret, my_cq, my_cq->cq_number, wc, wc->status,</font></tt>
<br><tt><font size=2>-
wc->opcode, wc->qp_num, wc->byte_len);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_poll_cq(struct ib_cq *cq, int num_entries,
struct ib_wc *wc)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_cq
*my_cq = NULL;</font></tt>
<br><tt><font size=2>- int nr = 0;</font></tt>
<br><tt><font size=2>- struct ib_wc
*current_wc = NULL;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*my_cq = container_of(cq, struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>+ int nr;</font></tt>
<br><tt><font size=2>+ struct ib_wc
*current_wc = wc;</font></tt>
<br><tt><font size=2> int ret
= 0;</font></tt>
<br><tt><font size=2>- unsigned long
spl_flags = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_CQ(cq);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(wc);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- my_cq = container_of(cq,
struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_CQ(my_cq);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_cq=%p
cq_num=%x num_entries=%d wc=%p",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, num_entries, wc);</font></tt>
<br><tt><font size=2>+ unsigned long
spl_flags;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (num_entries
< 1) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid num_entries=%d ehca_cq=%p
cq_num=%x",</font></tt>
<br><tt><font size=2>-
num_entries,
my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>+
ehca_err(cq->device, "Invalid num_entries=%d
ehca_cq=%p "</font></tt>
<br><tt><font size=2>+
"cq_num=%x",
num_entries, my_cq, my_cq->cq_number);</font></tt>
<br><tt><font size=2>
ret = -EINVAL;</font></tt>
<br><tt><font size=2>
goto poll_cq_exit0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- current_wc =
wc;</font></tt>
<br><tt><font size=2> spin_lock_irqsave(&my_cq->spinlock,
spl_flags);</font></tt>
<br><tt><font size=2> for (nr
= 0; nr < num_entries; nr++) {</font></tt>
<br><tt><font size=2>
ret = ehca_poll_cq_one(cq, current_wc);</font></tt>
<br><tt><font size=2>@@ -659,22 +631,12 @@ int ehca_poll_cq(struct ib_cq
*cq, int n</font></tt>
<br><tt><font size=2>
ret = nr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> poll_cq_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_cq=%p
cq_num=%x ret=%x wc=%p nr_entries=%d",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, ret, wc, nr);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_req_notify_cq(struct ib_cq *cq, enum
ib_cq_notify cq_notify)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_cq
*my_cq = NULL;</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_CQ(cq);</font></tt>
<br><tt><font size=2>- my_cq = container_of(cq,
struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2>- EHCA_CHECK_CQ(my_cq);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ehca_cq=%p
cq_num=%x cq_notif=%x",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, cq_notify);</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*my_cq = container_of(cq, struct ehca_cq, ib_cq);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> switch (cq_notify)
{</font></tt>
<br><tt><font size=2> case IB_CQ_SOLICITED:</font></tt>
<br><tt><font size=2>@@ -687,8 +649,5 @@ int ehca_req_notify_cq(struct
ib_cq *cq,</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ehca_cq=%p
cq_num=%x ret=%x",</font></tt>
<br><tt><font size=2>-
my_cq, my_cq->cq_number, ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_sqp.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_sqp.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_sqp.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_sqp.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -40,8 +40,6 @@</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "e_qp"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <linux/module.h></font></tt>
<br><tt><font size=2> #include <linux/err.h></font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2>@@ -51,11 +49,6 @@</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-extern int ehca_create_aqp1(struct ehca_shca *shca,
struct ehca_sport *sport);</font></tt>
<br><tt><font size=2>-extern int ehca_destroy_aqp1(struct ehca_sport *sport);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-extern int ehca_port_act_time;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> /**</font></tt>
<br><tt><font size=2> * ehca_define_sqp - Defines special queue pair
1 (GSI QP). When special queue</font></tt>
<br><tt><font size=2> * pair is created successfully, the corresponding
port gets active.</font></tt>
<br><tt><font size=2>@@ -69,15 +62,10 @@ u64 ehca_define_sqp(struct ehca_shca
*sh</font></tt>
<br><tt><font size=2>
struct ehca_qp *ehca_qp,</font></tt>
<br><tt><font size=2>
struct ib_qp_init_attr *qp_init_attr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- u32 pma_qp_nr
= 0;</font></tt>
<br><tt><font size=2>- u32 bma_qp_nr
= 0;</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u32 pma_qp_nr,
bma_qp_nr;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u8 port
= qp_init_attr->port_num;</font></tt>
<br><tt><font size=2>- int counter =
0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x
qp_type=%x",</font></tt>
<br><tt><font size=2>-
port, qp_init_attr->qp_type);</font></tt>
<br><tt><font size=2>+ int counter;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> shca->sport[port
- 1].port_state = IB_PORT_DOWN;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -93,31 +81,31 @@ u64 ehca_define_sqp(struct ehca_shca
*sh</font></tt>
<br><tt><font size=2>
&pma_qp_nr,
&bma_qp_nr);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (ret != H_SUCCESS) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Can't
define AQP1 for port %x. rc=%lx",</font></tt>
<br><tt><font size=2>-
port, ret);</font></tt>
<br><tt><font size=2>-
goto ehca_define_aqp1;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device,</font></tt>
<br><tt><font size=2>+
"Can't define AQP1 for port %x. rc=%lx",</font></tt>
<br><tt><font size=2>+
port, ret);</font></tt>
<br><tt><font size=2>+
return ret;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2> default:</font></tt>
<br><tt><font size=2>-
ret = H_PARAMETER;</font></tt>
<br><tt><font size=2>-
goto ehca_define_aqp1;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "invalid qp_type=%x",</font></tt>
<br><tt><font size=2>+
qp_init_attr->qp_type);</font></tt>
<br><tt><font size=2>+
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- while ((shca->sport[port
- 1].port_state != IB_PORT_ACTIVE) &&</font></tt>
<br><tt><font size=2>-
(counter < ehca_port_act_time)) {</font></tt>
<br><tt><font size=2>-
EDEB(6, "... wait until port %x is active",</font></tt>
<br><tt><font size=2>-
port);</font></tt>
<br><tt><font size=2>+ for (counter
= 0;</font></tt>
<br><tt><font size=2>+
shca->sport[port - 1].port_state != IB_PORT_ACTIVE &&</font></tt>
<br><tt><font size=2>+
counter < ehca_port_act_time;</font></tt>
<br><tt><font size=2>+
counter++) {</font></tt>
<br><tt><font size=2>+
ehca_dbg(&shca->ib_device, "... wait until
port %x is active",</font></tt>
<br><tt><font size=2>+
port);</font></tt>
<br><tt><font size=2>
msleep_interruptible(1000);</font></tt>
<br><tt><font size=2>-
counter++;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (counter
== ehca_port_act_time) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Port %x is not active.", port);</font></tt>
<br><tt><font size=2>-
ret = H_HARDWARE;</font></tt>
<br><tt><font size=2>+
ehca_err(&shca->ib_device, "Port %x is
not active.", port);</font></tt>
<br><tt><font size=2>+
return H_HARDWARE;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-ehca_define_aqp1:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return H_SUCCESS;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_tools.h
linux-2.6/drivers/infiniband/hw/ehca/ehca_tools.h</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_tools.h
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_tools.h
2006-08-30 20:00:17.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -57,195 +57,70 @@</font></tt>
<br><tt><font size=2> #include <linux/version.h></font></tt>
<br><tt><font size=2> #include <linux/notifier.h></font></tt>
<br><tt><font size=2> #include <linux/cpu.h></font></tt>
<br><tt><font size=2>+#include <linux/device.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include <asm/abs_addr.h></font></tt>
<br><tt><font size=2> #include <asm/ibmebus.h></font></tt>
<br><tt><font size=2> #include <asm/io.h></font></tt>
<br><tt><font size=2> #include <asm/pgtable.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define EHCA_EDEB_TRACE_MASK_SIZE 32</font></tt>
<br><tt><font size=2>-extern u8 ehca_edeb_mask[EHCA_EDEB_TRACE_MASK_SIZE];</font></tt>
<br><tt><font size=2>-#define EDEB_ID_TO_U32(str4) (str4[3] | (str4[2]
<< 8) | (str4[1] << 16) | \</font></tt>
<br><tt><font size=2>-
(str4[0] << 24))</font></tt>
<br><tt><font size=2>+extern int ehca_debug_level;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-static inline u64 ehca_edeb_filter(const u32 level,</font></tt>
<br><tt><font size=2>-
const u32 id, const u32 line)</font></tt>
<br><tt><font size=2>-{</font></tt>
<br><tt><font size=2>- u64 ret = 0;</font></tt>
<br><tt><font size=2>- u32 filenr =
0;</font></tt>
<br><tt><font size=2>- u32 filter_level
= 9;</font></tt>
<br><tt><font size=2>- u32 dynamic_level
= 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- /*</font></tt>
<br><tt><font size=2>- * This is code
written for the gcc -O2 optimizer</font></tt>
<br><tt><font size=2>- * which should
collapse to two single ints.</font></tt>
<br><tt><font size=2>- * Filter_level
is the first level kicked out by</font></tt>
<br><tt><font size=2>- * compiler and
means trace everything below 6.</font></tt>
<br><tt><font size=2>- */</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("ehav"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x01;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("clas"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x02;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("cqeq"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x03;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("shca"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x05;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("eirq"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x06;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("lMad"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x07;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("mcas"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x08;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("mrmw"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x09;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("vpd
")) {</font></tt>
<br><tt><font size=2>-
filenr = 0x0a;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("e_qp"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x0b;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("uqes"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x0c;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("PHYP"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x0d;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("hcpi"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x0e;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("iptz"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x0f;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("spta"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x10;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("simp"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x11;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- if (id == EDEB_ID_TO_U32("reqs"))
{</font></tt>
<br><tt><font size=2>-
filenr = 0x12;</font></tt>
<br><tt><font size=2>-
filter_level = 8;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if ((filenr -
1) > sizeof(ehca_edeb_mask)) {</font></tt>
<br><tt><font size=2>-
filenr = 0;</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (filenr ==
0) {</font></tt>
<br><tt><font size=2>-
filter_level = 9;</font></tt>
<br><tt><font size=2>- } /* default
*/</font></tt>
<br><tt><font size=2>- ret = filenr
* 0x10000 + line;</font></tt>
<br><tt><font size=2>- if (filter_level
<= level) {</font></tt>
<br><tt><font size=2>-
return ret | 0x100000000L; /* this is the flag to
not trace */</font></tt>
<br><tt><font size=2>- }</font></tt>
<br><tt><font size=2>- dynamic_level
= ehca_edeb_mask[filenr];</font></tt>
<br><tt><font size=2>- if (likely(dynamic_level
<= level)) {</font></tt>
<br><tt><font size=2>-
ret = ret | 0x100000000L;</font></tt>
<br><tt><font size=2>- };</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>-}</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#ifdef EHCA_USE_HCALL_KERNEL</font></tt>
<br><tt><font size=2>-#ifdef CONFIG_PPC_PSERIES</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#include <asm/paca.h></font></tt>
<br><tt><font size=2>+#define ehca_dbg(ib_dev, format, arg...) \</font></tt>
<br><tt><font size=2>+ do { \</font></tt>
<br><tt><font size=2>+
if (unlikely(ehca_debug_level)) \</font></tt>
<br><tt><font size=2>+
dev_printk(KERN_DEBUG,
(ib_dev)->dma_device, \</font></tt>
<br><tt><font size=2>+
"PU%04x EHCA_DBG:%s " format "\n",
\</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, \</font></tt>
<br><tt><font size=2>+
## arg); \</font></tt>
<br><tt><font size=2>+ } while (0)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-/*</font></tt>
<br><tt><font size=2>- * IS_EDEB_ON - Checks if debug is on for the given
level.</font></tt>
<br><tt><font size=2>- */</font></tt>
<br><tt><font size=2>-#define IS_EDEB_ON(level) \</font></tt>
<br><tt><font size=2>-((ehca_edeb_filter(level, EDEB_ID_TO_U32(DEB_PREFIX),
__LINE__) & \</font></tt>
<br><tt><font size=2>- 0x100000000L) == 0)</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EDEB_P_GENERIC(level,idstring,format,args...)
\</font></tt>
<br><tt><font size=2>-do { \</font></tt>
<br><tt><font size=2>- u64 ehca_edeb_filterresult
=
\</font></tt>
<br><tt><font size=2>-
ehca_edeb_filter(level, EDEB_ID_TO_U32(DEB_PREFIX),
__LINE__);\</font></tt>
<br><tt><font size=2>- if ((ehca_edeb_filterresult
& 0x100000000L) == 0)
\</font></tt>
<br><tt><font size=2>-
printk("PU%04x %08x:%s " idstring "
"format "\n", \</font></tt>
<br><tt><font size=2>-
get_paca()->paca_index, (u32)(ehca_edeb_filterresult),
\</font></tt>
<br><tt><font size=2>-
__func__, ##args);
\</font></tt>
<br><tt><font size=2>-} while (1 == 0)</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#elif REAL_HCALL</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EDEB_P_GENERIC(level,idstring,format,args...)
\</font></tt>
<br><tt><font size=2>-do { \</font></tt>
<br><tt><font size=2>- u64 ehca_edeb_filterresult
=
\</font></tt>
<br><tt><font size=2>-
ehca_edeb_filter(level, EDEB_ID_TO_U32(DEB_PREFIX),
__LINE__); \</font></tt>
<br><tt><font size=2>- if ((ehca_edeb_filterresult
& 0x100000000L) == 0)
\</font></tt>
<br><tt><font size=2>-
printk("%08x:%s " idstring " "format
"\n", \</font></tt>
<br><tt><font size=2>-
(u32)(ehca_edeb_filterresult),
\</font></tt>
<br><tt><font size=2>-
__func__, ##args);
\</font></tt>
<br><tt><font size=2>-} while (1 == 0)</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#endif</font></tt>
<br><tt><font size=2>-#else</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define IS_EDEB_ON(level) (1)</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EDEB_P_GENERIC(level,idstring,format,args...)
\</font></tt>
<br><tt><font size=2>-do { \</font></tt>
<br><tt><font size=2>- printk("%s
" idstring " "format "\n",
\</font></tt>
<br><tt><font size=2>-
__func__, ##args);
\</font></tt>
<br><tt><font size=2>-} while (1 == 0)</font></tt>
<br><tt><font size=2>+#define ehca_info(ib_dev, format, arg...) \</font></tt>
<br><tt><font size=2>+ dev_info((ib_dev)->dma_device,
"PU%04x EHCA_INFO:%s " format "\n", \</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, ## arg)</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+#define ehca_warn(ib_dev, format, arg...) \</font></tt>
<br><tt><font size=2>+ dev_warn((ib_dev)->dma_device,
"PU%04x EHCA_WARN:%s " format "\n", \</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, ## arg)</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+#define ehca_err(ib_dev, format, arg...) \</font></tt>
<br><tt><font size=2>+ dev_err((ib_dev)->dma_device,
"PU%04x EHCA_ERR:%s " format "\n", \</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, ## arg)</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+/* use this one only if no ib_dev available */</font></tt>
<br><tt><font size=2>+#define ehca_gen_dbg(format, arg...) \</font></tt>
<br><tt><font size=2>+ do { \</font></tt>
<br><tt><font size=2>+
if (unlikely(ehca_debug_level)) \</font></tt>
<br><tt><font size=2>+
printk(KERN_DEBUG
"PU%04x EHCA_DBG:%s " format "\n",\</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, ## arg); \</font></tt>
<br><tt><font size=2>+ } while (0)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#endif</font></tt>
<br><tt><font size=2>+#define ehca_gen_warn(format, arg...) \</font></tt>
<br><tt><font size=2>+ do { \</font></tt>
<br><tt><font size=2>+
if (unlikely(ehca_debug_level)) \</font></tt>
<br><tt><font size=2>+
printk(KERN_INFO
"PU%04x EHCA_WARN:%s " format "\n",\</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, ## arg); \</font></tt>
<br><tt><font size=2>+ } while (0)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-/**</font></tt>
<br><tt><font size=2>- * EDEB - Trace output macro.</font></tt>
<br><tt><font size=2>- * @level: tracelevel</font></tt>
<br><tt><font size=2>- * @format: optional format string, use ""
if not desired</font></tt>
<br><tt><font size=2>- * @args: printf like arguments for trace</font></tt>
<br><tt><font size=2>- */</font></tt>
<br><tt><font size=2>-#define EDEB(level,format,args...) \</font></tt>
<br><tt><font size=2>- EDEB_P_GENERIC(level,"",format,##args)</font></tt>
<br><tt><font size=2>-#define EDEB_ERR(level,format,args...) \</font></tt>
<br><tt><font size=2>- EDEB_P_GENERIC(level,"HCAD_ERROR
",format,##args)</font></tt>
<br><tt><font size=2>-#define EDEB_EN(level,format,args...) \</font></tt>
<br><tt><font size=2>- EDEB_P_GENERIC(level,">>>",format,##args)</font></tt>
<br><tt><font size=2>-#define EDEB_EX(level,format,args...) \</font></tt>
<br><tt><font size=2>- EDEB_P_GENERIC(level,"<<<",format,##args)</font></tt>
<br><tt><font size=2>+#define ehca_gen_err(format, arg...) \</font></tt>
<br><tt><font size=2>+ printk(KERN_ERR
"PU%04x EHCA_ERR:%s " format "\n", \</font></tt>
<br><tt><font size=2>+
get_paca()->paca_index, __FUNCTION__, ## arg)</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /**</font></tt>
<br><tt><font size=2>- * EDEB_DMP - macro to dump a memory block, whose
length is n*8 bytes.</font></tt>
<br><tt><font size=2>+ * ehca_dmp - printk a memory block, whose length
is n*8 bytes.</font></tt>
<br><tt><font size=2> * Each line has the following layout:</font></tt>
<br><tt><font size=2> * <format string> adr=X ofs=Y <8 bytes
hex> <8 bytes hex></font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2>-#define EDEB_DMP(level,adr,len,format,args...) \</font></tt>
<br><tt><font size=2>+#define ehca_dmp(adr, len, format, args...) \</font></tt>
<br><tt><font size=2> do {
\</font></tt>
<br><tt><font size=2>
unsigned int x;
\</font></tt>
<br><tt><font size=2>
unsigned int l = (unsigned int)(len); \</font></tt>
<br><tt><font size=2>
unsigned char *deb = (unsigned char*)(adr);
\</font></tt>
<br><tt><font size=2>
for (x = 0; x < l; x += 16) { \</font></tt>
<br><tt><font size=2>-
EDEB(level, format "
adr=%p ofs=%04x %016lx %016lx", \</font></tt>
<br><tt><font size=2>-
##args, deb, x, \</font></tt>
<br><tt><font size=2>-
*((u64 *)&deb[0]), *((u64 *)&deb[8])); \</font></tt>
<br><tt><font size=2>+
printk("EHCA_DMP:%s"
format \</font></tt>
<br><tt><font size=2>+
" adr=%p ofs=%04x %016lx %016lx\n", \</font></tt>
<br><tt><font size=2>+
__FUNCTION__, ##args, deb, x, \</font></tt>
<br><tt><font size=2>+
*((u64 *)&deb[0]), *((u64 *)&deb[8])); \</font></tt>
<br><tt><font size=2>
deb +=
16; \</font></tt>
<br><tt><font size=2>
} \</font></tt>
<br><tt><font size=2> } while
(0)</font></tt>
<br><tt><font size=2>@@ -275,129 +150,8 @@ do { \</font></tt>
<br><tt><font size=2> * EHCA_BMASK_GET - extract a parameter from
value by mask</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> #define EHCA_BMASK_GET(mask,value) \</font></tt>
<br><tt><font size=2>- ( EHCA_BMASK_MASK(mask)&
(((u64)(value))>>EHCA_BMASK_SHIFTPOS(mask)))</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define PARANOIA_MODE</font></tt>
<br><tt><font size=2>-#ifdef PARANOIA_MODE</font></tt>
<br><tt><font size=2>+ (EHCA_BMASK_MASK(mask)&
(((u64)(value))>>EHCA_BMASK_SHIFTPOS(mask)))</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_ADR_P(adr)
\</font></tt>
<br><tt><font size=2>- if (unlikely(adr
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "adr=%p check failed line %i",
adr, \</font></tt>
<br><tt><font size=2>-
__LINE__);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_ADR(adr)
\</font></tt>
<br><tt><font size=2>- if (unlikely(adr
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "adr=%p check failed line %i",
adr, \</font></tt>
<br><tt><font size=2>-
__LINE__);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_DEVICE_P(device)
\</font></tt>
<br><tt><font size=2>- if (unlikely(device
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "device=%p check failed", device);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_DEVICE(device)
\</font></tt>
<br><tt><font size=2>- if (unlikely(device
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "device=%p check failed", device);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_PD(pd)
\</font></tt>
<br><tt><font size=2>- if (unlikely(pd
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "pd=%p check failed", pd);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_PD_P(pd)
\</font></tt>
<br><tt><font size=2>- if (unlikely(pd
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "pd=%p check failed", pd);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_AV(av)
\</font></tt>
<br><tt><font size=2>- if (unlikely(av
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "av=%p check failed", av);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_AV_P(av)
\</font></tt>
<br><tt><font size=2>- if (unlikely(av
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "av=%p check failed", av);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_CQ(cq)
\</font></tt>
<br><tt><font size=2>- if (unlikely(cq
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "cq=%p check failed", cq);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_CQ_P(cq)
\</font></tt>
<br><tt><font size=2>- if (unlikely(cq
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "cq=%p check failed", cq);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_EQ(eq)
\</font></tt>
<br><tt><font size=2>- if (unlikely(eq
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "eq=%p check failed", eq);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_EQ_P(eq)
\</font></tt>
<br><tt><font size=2>- if (unlikely(eq
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "eq=%p check failed", eq);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_QP(qp)
\</font></tt>
<br><tt><font size=2>- if (unlikely(qp
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "qp=%p check failed", qp);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_QP_P(qp)
\</font></tt>
<br><tt><font size=2>- if (unlikely(qp
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "qp=%p check failed", qp);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_MR(mr)
\</font></tt>
<br><tt><font size=2>- if (unlikely(mr
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "mr=%p check failed", mr);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_MR_P(mr)
\</font></tt>
<br><tt><font size=2>- if (unlikely(mr
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "mr=%p check failed", mr);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_MW(mw)
\</font></tt>
<br><tt><font size=2>- if (unlikely(mw
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "mw=%p check failed", mw);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_MW_P(mw)
\</font></tt>
<br><tt><font size=2>- if (unlikely(mw
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "mw=%p check failed", mw);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_FMR(fmr)
\</font></tt>
<br><tt><font size=2>- if (unlikely(fmr
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "fmr=%p check failed", fmr);
\</font></tt>
<br><tt><font size=2>-
return -EFAULT; }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_FMR_P(fmr)
\</font></tt>
<br><tt><font size=2>- if (unlikely(fmr
== 0)) {
\</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "fmr=%p check failed", fmr);
\</font></tt>
<br><tt><font size=2>-
return ERR_PTR(-EFAULT); }</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_REGISTER_PD(device,pd)</font></tt>
<br><tt><font size=2>-#define EHCA_REGISTER_AV(pd,av)</font></tt>
<br><tt><font size=2>-#define EHCA_DEREGISTER_PD(PD)</font></tt>
<br><tt><font size=2>-#define EHCA_DEREGISTER_AV(av)</font></tt>
<br><tt><font size=2>-#else</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_DEVICE_P(device)</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-#define EHCA_CHECK_PD(pd)</font></tt>
<br><tt><font size=2>-#define EHCA_REGISTER_PD(device,pd)</font></tt>
<br><tt><font size=2>-#define EHCA_DEREGISTER_PD(PD)</font></tt>
<br><tt><font size=2>-#endif</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-static inline int ehca_adr_bad(void *adr)</font></tt>
<br><tt><font size=2>-{</font></tt>
<br><tt><font size=2>- return !adr;</font></tt>
<br><tt><font size=2>-}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* Converts ehca to ib return code */</font></tt>
<br><tt><font size=2> static inline int ehca2ib_return_code(u64 ehca_rc)</font></tt>
<br><tt><font size=2>@@ -414,4 +168,5 @@ static inline int ehca2ib_return_code(u6</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> #endif /* EHCA_TOOLS_H */</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_uverbs.c
linux-2.6/drivers/infiniband/hw/ehca/ehca_uverbs.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ehca_uverbs.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_uverbs.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -40,9 +40,6 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#undef DEB_PREFIX</font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "uver"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/current.h></font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2>@@ -54,30 +51,20 @@</font></tt>
<br><tt><font size=2> struct ib_ucontext *ehca_alloc_ucontext(struct
ib_device *device,</font></tt>
<br><tt><font size=2>
struct
ib_udata *udata)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_ucontext
*my_context = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR_P(device);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "device=%p
name=%s", device, device->name);</font></tt>
<br><tt><font size=2>+ struct ehca_ucontext
*my_context;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> my_context
= kzalloc(sizeof *my_context, GFP_KERNEL);</font></tt>
<br><tt><font size=2> if (!my_context)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Out of memory device=%p", device);</font></tt>
<br><tt><font size=2>+
ehca_err(device, "Out of memory device=%p",
device);</font></tt>
<br><tt><font size=2>
return ERR_PTR(-ENOMEM);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "device=%p
ucontext=%p", device, my_context);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return &my_context->ib_ucontext;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int ehca_dealloc_ucontext(struct ib_ucontext
*context)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ehca_ucontext
*my_context = NULL;</font></tt>
<br><tt><font size=2>- EHCA_CHECK_ADR(context);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ucontext=%p",
context);</font></tt>
<br><tt><font size=2>- my_context =
container_of(context, struct ehca_ucontext, ib_ucontext);</font></tt>
<br><tt><font size=2>- kfree(my_context);</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ucontext=%p",
context);</font></tt>
<br><tt><font size=2>+ kfree(container_of(context,
struct ehca_ucontext, ib_ucontext));</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -91,83 +78,88 @@ struct page *ehca_nopage(struct
vm_area_</font></tt>
<br><tt><font size=2> u32 rsrc_type
= (fileoffset >> 24) & 0xF; /* sq,rq,cmnd_window */</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*cq;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*qp;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*pd;</font></tt>
<br><tt><font size=2>+ u64 offset;</font></tt>
<br><tt><font size=2>+ void *vaddr;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "vm_start=%lx
vm_end=%lx vm_page_prot=%lx vm_fileoff=%lx "</font></tt>
<br><tt><font size=2>-
"address=%lx",</font></tt>
<br><tt><font size=2>-
vma->vm_start, vma->vm_end, vma->vm_page_prot,
fileoffset,</font></tt>
<br><tt><font size=2>-
address);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (q_type ==
1) { /* CQ */</font></tt>
<br><tt><font size=2>-
struct ehca_cq *cq = NULL;</font></tt>
<br><tt><font size=2>-
u64 offset;</font></tt>
<br><tt><font size=2>-
void *vaddr = NULL;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+ switch (q_type)
{</font></tt>
<br><tt><font size=2>+ case 1: /* CQ
*/</font></tt>
<br><tt><font size=2>
spin_lock_irqsave(&ehca_cq_idr_lock, flags);</font></tt>
<br><tt><font size=2>
cq = idr_find(&ehca_cq_idr, idr_handle);</font></tt>
<br><tt><font size=2>
spin_unlock_irqrestore(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
if (cq->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>-
cur_pid, cq->ownpid);</font></tt>
<br><tt><font size=2>+
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>+
if (!cq) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("cq
is NULL ret=NOPAGE_SIGBUS");</font></tt>
<br><tt><font size=2>
return
NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>-
if (!cq) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "cq
is NULL ret=NOPAGE_SIGBUS");</font></tt>
<br><tt><font size=2>+
if (cq->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>+
ehca_err(cq->ib_cq.device,</font></tt>
<br><tt><font size=2>+
"Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
cur_pid, cq->ownpid);</font></tt>
<br><tt><font size=2>
return
NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>
if (rsrc_type == 2) {</font></tt>
<br><tt><font size=2>-
EDEB(6, "cq=%p
cq queuearea", cq);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->ib_cq.device,
"cq=%p cq queuearea", cq);</font></tt>
<br><tt><font size=2>
offset
= address - vma->vm_start;</font></tt>
<br><tt><font size=2>
vaddr =
ipz_qeit_calc(&cq->ipz_queue, offset);</font></tt>
<br><tt><font size=2>-
EDEB(6, "offset=%lx
vaddr=%p", offset, vaddr);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->ib_cq.device,
"offset=%lx vaddr=%p",</font></tt>
<br><tt><font size=2>+
offset, vaddr);</font></tt>
<br><tt><font size=2>
mypage
= virt_to_page(vaddr);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>- } else if (q_type
== 2) { /* QP */</font></tt>
<br><tt><font size=2>-
struct ehca_qp *qp = NULL;</font></tt>
<br><tt><font size=2>-
struct ehca_pd *pd = NULL;</font></tt>
<br><tt><font size=2>-
u64 offset;</font></tt>
<br><tt><font size=2>-
void *vaddr = NULL;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+ case 2: /* QP
*/</font></tt>
<br><tt><font size=2>
spin_lock_irqsave(&ehca_qp_idr_lock, flags);</font></tt>
<br><tt><font size=2>
qp = idr_find(&ehca_qp_idr, idr_handle);</font></tt>
<br><tt><font size=2>
spin_unlock_irqrestore(&ehca_qp_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>+
if (!qp) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("qp
is NULL ret=NOPAGE_SIGBUS");</font></tt>
<br><tt><font size=2>+
return NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2>+
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
pd = container_of(qp->ib_qp.pd, struct ehca_pd,
ib_pd);</font></tt>
<br><tt><font size=2>
if (pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(qp->ib_qp.device,</font></tt>
<br><tt><font size=2>+
"Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid, pd->ownpid);</font></tt>
<br><tt><font size=2>
return
NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>-
if (!qp) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "qp
is NULL ret=NOPAGE_SIGBUS");</font></tt>
<br><tt><font size=2>-
return NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2>-
}</font></tt>
<br><tt><font size=2>
if (rsrc_type == 2) {
/* rqueue */</font></tt>
<br><tt><font size=2>-
EDEB(6, "qp=%p
qp rqueuearea", qp);</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"qp=%p qp rqueuearea", qp);</font></tt>
<br><tt><font size=2>
offset
= address - vma->vm_start;</font></tt>
<br><tt><font size=2>
vaddr =
ipz_qeit_calc(&qp->ipz_rqueue, offset);</font></tt>
<br><tt><font size=2>-
EDEB(6, "offset=%lx
vaddr=%p", offset, vaddr);</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"offset=%lx vaddr=%p",</font></tt>
<br><tt><font size=2>+
offset, vaddr);</font></tt>
<br><tt><font size=2>
mypage
= virt_to_page(vaddr);</font></tt>
<br><tt><font size=2>
} else if (rsrc_type == 3) {
/* squeue */</font></tt>
<br><tt><font size=2>-
EDEB(6, "qp=%p
qp squeuearea", qp);</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"qp=%p qp squeuearea", qp);</font></tt>
<br><tt><font size=2>
offset
= address - vma->vm_start;</font></tt>
<br><tt><font size=2>
vaddr =
ipz_qeit_calc(&qp->ipz_squeue, offset);</font></tt>
<br><tt><font size=2>-
EDEB(6, "offset=%lx
vaddr=%p", offset, vaddr);</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"offset=%lx vaddr=%p",</font></tt>
<br><tt><font size=2>+
offset, vaddr);</font></tt>
<br><tt><font size=2>
mypage
= virt_to_page(vaddr);</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ default:</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad queue type %x", q_type);</font></tt>
<br><tt><font size=2>+
return NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (!mypage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid page adr==NULL ret=NOPAGE_SIGBUS");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Invalid page adr==NULL ret=NOPAGE_SIGBUS");</font></tt>
<br><tt><font size=2>
return NOPAGE_SIGBUS;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> get_page(mypage);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "page
adr=%p", mypage);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> return mypage;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -181,159 +173,161 @@ int ehca_mmap(struct ib_ucontext
*contex</font></tt>
<br><tt><font size=2> u32 idr_handle
= fileoffset >> 32;</font></tt>
<br><tt><font size=2> u32 q_type
= (fileoffset >> 28) & 0xF;
/* CQ, QP,... */</font></tt>
<br><tt><font size=2> u32 rsrc_type
= (fileoffset >> 24) & 0xF; /* sq,rq,cmnd_window */</font></tt>
<br><tt><font size=2>- u32 ret = -EFAULT;
/* assume the worst
*/</font></tt>
<br><tt><font size=2>- u64 vsize = 0;
/*
must be calculated/set below */</font></tt>
<br><tt><font size=2>- u64 physical
= 0; /* must be calculated/set below
*/</font></tt>
<br><tt><font size=2> u32 cur_pid
= current->tgid;</font></tt>
<br><tt><font size=2>+ u32 ret;</font></tt>
<br><tt><font size=2>+ u64 vsize, physical;</font></tt>
<br><tt><font size=2> unsigned
long flags;</font></tt>
<br><tt><font size=2>+ struct ehca_cq
*cq;</font></tt>
<br><tt><font size=2>+ struct ehca_qp
*qp;</font></tt>
<br><tt><font size=2>+ struct ehca_pd
*pd;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "vm_start=%lx
vm_end=%lx vm_page_prot=%lx vm_fileoff=%lx",</font></tt>
<br><tt><font size=2>-
vma->vm_start, vma->vm_end, vma->vm_page_prot,
fileoffset);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (q_type ==
1) { /* CQ */</font></tt>
<br><tt><font size=2>-
struct ehca_cq *cq;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+ switch (q_type)
{</font></tt>
<br><tt><font size=2>+ case 1:
/* CQ */</font></tt>
<br><tt><font size=2>
spin_lock_irqsave(&ehca_cq_idr_lock, flags);</font></tt>
<br><tt><font size=2>
cq = idr_find(&ehca_cq_idr, idr_handle);</font></tt>
<br><tt><font size=2>
spin_unlock_irqrestore(&ehca_cq_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>+
if (!cq)</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>
if (cq->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(cq->ib_cq.device,</font></tt>
<br><tt><font size=2>+
"Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid, cq->ownpid);</font></tt>
<br><tt><font size=2>
return
-ENOMEM;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>-
if (!cq)</font></tt>
<br><tt><font size=2>-
return -EINVAL;</font></tt>
<br><tt><font size=2>-
if (!cq->ib_cq.uobject)</font></tt>
<br><tt><font size=2>-
return -EINVAL;</font></tt>
<br><tt><font size=2>-
if (cq->ib_cq.uobject->context != context)</font></tt>
<br><tt><font size=2>+
if (!cq->ib_cq.uobject || cq->ib_cq.uobject->context
!= context)</font></tt>
<br><tt><font size=2>
return
-EINVAL;</font></tt>
<br><tt><font size=2>-
if (rsrc_type == 1) { /*
galpa fw handle */</font></tt>
<br><tt><font size=2>-
EDEB(6, "cq=%p
cq triggerarea", cq);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
switch (rsrc_type) {</font></tt>
<br><tt><font size=2>+
case 1: /* galpa fw handle */</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->ib_cq.device,
"cq=%p cq triggerarea", cq);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2>
vsize =
vma->vm_end - vma->vm_start;</font></tt>
<br><tt><font size=2>
if (vsize
!= EHCA_PAGESIZE) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "invalid vsize=%lx",</font></tt>
<br><tt><font size=2>+
ehca_err(cq->ib_cq.device, "invalid vsize=%lx",</font></tt>
<br><tt><font size=2>
vma->vm_end
- vma->vm_start);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
physical
= cq->galpas.user.fw_handle;</font></tt>
<br><tt><font size=2>
vma->vm_page_prot
= pgprot_noncached(vma->vm_page_prot);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_IO | VM_RESERVED;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(6, "vsize=%lx
physical=%lx", vsize, physical);</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->ib_cq.device,</font></tt>
<br><tt><font size=2>+
"vsize=%lx physical=%lx", vsize, physical);</font></tt>
<br><tt><font size=2>
ret = remap_pfn_range(vma,
vma->vm_start,</font></tt>
<br><tt><font size=2>
physical >> PAGE_SHIFT, vsize,</font></tt>
<br><tt><font size=2>
vma->vm_page_prot);</font></tt>
<br><tt><font size=2>
if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "remap_pfn_range() failed ret=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(cq->ib_cq.device,</font></tt>
<br><tt><font size=2>+
"remap_pfn_range()
failed ret=%x",</font></tt>
<br><tt><font size=2>
ret);</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>-
} else if (rsrc_type == 2) {
/* cq queue_addr */</font></tt>
<br><tt><font size=2>-
EDEB(6, "cq=%p
cq q_addr", cq);</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
case 2: /* cq queue_addr */</font></tt>
<br><tt><font size=2>+
ehca_dbg(cq->ib_cq.device,
"cq=%p cq q_addr", cq);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2>
vma->vm_ops
= &ehcau_vm_ops;</font></tt>
<br><tt><font size=2>-
ret = 0;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>-
} else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(6, "bad
resource type %x", rsrc_type);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
default:</font></tt>
<br><tt><font size=2>+
ehca_err(cq->ib_cq.device,
"bad resource type %x",</font></tt>
<br><tt><font size=2>+
rsrc_type);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>- } else if (q_type
== 2) { /* QP */</font></tt>
<br><tt><font size=2>-
struct ehca_qp *qp = NULL;</font></tt>
<br><tt><font size=2>-
struct ehca_pd *pd = NULL;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+ case 2: /* QP
*/</font></tt>
<br><tt><font size=2>
spin_lock_irqsave(&ehca_qp_idr_lock, flags);</font></tt>
<br><tt><font size=2>
qp = idr_find(&ehca_qp_idr, idr_handle);</font></tt>
<br><tt><font size=2>
spin_unlock_irqrestore(&ehca_qp_idr_lock,
flags);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>+
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>+
if (!qp)</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>
pd = container_of(qp->ib_qp.pd, struct ehca_pd,
ib_pd);</font></tt>
<br><tt><font size=2>
if (pd->ownpid != cur_pid) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Invalid
caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(qp->ib_qp.device,</font></tt>
<br><tt><font size=2>+
"Invalid caller pid=%x ownpid=%x",</font></tt>
<br><tt><font size=2>
cur_pid, pd->ownpid);</font></tt>
<br><tt><font size=2>
return
-ENOMEM;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
/* make sure this mmap really belongs to the authorized
user */</font></tt>
<br><tt><font size=2>-
if (!qp || !qp->ib_qp.uobject ||</font></tt>
<br><tt><font size=2>-
qp->ib_qp.uobject->context !=
context) {</font></tt>
<br><tt><font size=2>-
EDEB(6, "qp=%p,
uobject=%p, context=%p",</font></tt>
<br><tt><font size=2>-
qp, qp->ib_qp.uobject, qp->ib_qp.uobject->context);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>-
}</font></tt>
<br><tt><font size=2>-
if (rsrc_type == 1) { /*
galpa fw handle */</font></tt>
<br><tt><font size=2>-
EDEB(6, "qp=%p
qp triggerarea", qp);</font></tt>
<br><tt><font size=2>+
if (!qp->ib_qp.uobject || qp->ib_qp.uobject->context
!= context)</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
switch (rsrc_type) {</font></tt>
<br><tt><font size=2>+
case 1: /* galpa fw handle */</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"qp=%p qp triggerarea", qp);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2>
vsize =
vma->vm_end - vma->vm_start;</font></tt>
<br><tt><font size=2>
if (vsize
!= EHCA_PAGESIZE) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "invalid vsize=%lx",</font></tt>
<br><tt><font size=2>+
ehca_err(qp->ib_qp.device, "invalid vsize=%lx",</font></tt>
<br><tt><font size=2>
vma->vm_end
- vma->vm_start);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
physical
= qp->galpas.user.fw_handle;</font></tt>
<br><tt><font size=2>
vma->vm_page_prot
= pgprot_noncached(vma->vm_page_prot);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_IO | VM_RESERVED;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-
EDEB(6, "vsize=%lx
physical=%lx", vsize, physical);</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"vsize=%lx physical=%lx",</font></tt>
<br><tt><font size=2>+
vsize, physical);</font></tt>
<br><tt><font size=2>
ret = remap_pfn_range(vma,
vma->vm_start,</font></tt>
<br><tt><font size=2>
physical >> PAGE_SHIFT, vsize,</font></tt>
<br><tt><font size=2>
vma->vm_page_prot);</font></tt>
<br><tt><font size=2>
if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "remap_pfn_range() failed ret=%x",</font></tt>
<br><tt><font size=2>+
ehca_err(qp->ib_qp.device,</font></tt>
<br><tt><font size=2>+
"remap_pfn_range()
failed ret=%x",</font></tt>
<br><tt><font size=2>
ret);</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>-
} else if (rsrc_type == 2) {
/* qp rqueue_addr */</font></tt>
<br><tt><font size=2>-
EDEB(6, "qp=%p
qp rqueue_addr", qp);</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
case 2: /* qp rqueue_addr */</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"qp=%p qp rqueue_addr", qp);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2>
vma->vm_ops
= &ehcau_vm_ops;</font></tt>
<br><tt><font size=2>-
ret = 0;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>-
} else if (rsrc_type == 3) {
/* qp squeue_addr */</font></tt>
<br><tt><font size=2>-
EDEB(6, "qp=%p
qp squeue_addr", qp);</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
case 3: /* qp squeue_addr */</font></tt>
<br><tt><font size=2>+
ehca_dbg(qp->ib_qp.device,
"qp=%p qp squeue_addr", qp);</font></tt>
<br><tt><font size=2>
vma->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2>
vma->vm_ops
= &ehcau_vm_ops;</font></tt>
<br><tt><font size=2>-
ret = 0;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>-
} else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad
resource type %x", rsrc_type);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
default:</font></tt>
<br><tt><font size=2>+
ehca_err(qp->ib_qp.device,
"bad resource type %x",</font></tt>
<br><tt><font size=2>+
rsrc_type);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2>- } else {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "bad queue type %x", q_type);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
goto mmap_exit0;</font></tt>
<br><tt><font size=2>+
break;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ default:</font></tt>
<br><tt><font size=2>+
ehca_gen_err("bad queue type %x", q_type);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-mmap_exit0:</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%x",
ret);</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-int ehca_mmap_nopage(u64 foffset, u64 length, void
** mapped,</font></tt>
<br><tt><font size=2>-
struct vm_area_struct ** vma)</font></tt>
<br><tt><font size=2>+int ehca_mmap_nopage(u64 foffset, u64 length, void
**mapped,</font></tt>
<br><tt><font size=2>+
struct vm_area_struct **vma)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "foffset=%lx
length=%lx", foffset, length);</font></tt>
<br><tt><font size=2> down_write(¤t->mm->mmap_sem);</font></tt>
<br><tt><font size=2> *mapped
= (void*)do_mmap(NULL,0, length, PROT_WRITE,</font></tt>
<br><tt><font size=2>
MAP_SHARED | MAP_ANONYMOUS,</font></tt>
<br><tt><font size=2>
foffset);</font></tt>
<br><tt><font size=2> up_write(¤t->mm->mmap_sem);</font></tt>
<br><tt><font size=2> if (!(*mapped))
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "couldn't mmap foffset=%lx length=%lx",</font></tt>
<br><tt><font size=2>-
foffset, length);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("couldn't mmap foffset=%lx length=%lx",</font></tt>
<br><tt><font size=2>+
foffset, length);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -342,49 +336,47 @@ int ehca_mmap_nopage(u64 foffset,
u64 le</font></tt>
<br><tt><font size=2>
down_write(¤t->mm->mmap_sem);</font></tt>
<br><tt><font size=2>
do_munmap(current->mm, 0, length);</font></tt>
<br><tt><font size=2>
up_write(¤t->mm->mmap_sem);</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "couldn't find vma queue=%p",
*mapped);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("couldn't find vma queue=%p",
*mapped);</font></tt>
<br><tt><font size=2>
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> (*vma)->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2> (*vma)->vm_ops
= &ehcau_vm_ops;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "mapped=%p",
*mapped);</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-int ehca_mmap_register(u64 physical, void ** mapped,</font></tt>
<br><tt><font size=2>-
struct vm_area_struct ** vma)</font></tt>
<br><tt><font size=2>+int ehca_mmap_register(u64 physical, void **mapped,</font></tt>
<br><tt><font size=2>+
struct vm_area_struct **vma)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>+ int ret;</font></tt>
<br><tt><font size=2> unsigned
long vsize;</font></tt>
<br><tt><font size=2> /* ehca
hw supports only 4k page */</font></tt>
<br><tt><font size=2> ret = ehca_mmap_nopage(0,
EHCA_PAGESIZE, mapped, vma);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB(4, "could'nt mmap physical=%lx", physical);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("could'nt mmap physical=%lx",
physical);</font></tt>
<br><tt><font size=2>
return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> (*vma)->vm_flags
|= VM_RESERVED;</font></tt>
<br><tt><font size=2> vsize =
(*vma)->vm_end - (*vma)->vm_start;</font></tt>
<br><tt><font size=2> if (vsize
!= EHCA_PAGESIZE) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "invalid vsize=%lx",</font></tt>
<br><tt><font size=2>-
(*vma)->vm_end
- (*vma)->vm_start);</font></tt>
<br><tt><font size=2>-
ret = -EINVAL;</font></tt>
<br><tt><font size=2>-
return ret;</font></tt>
<br><tt><font size=2>+
ehca_gen_err("invalid vsize=%lx",</font></tt>
<br><tt><font size=2>+
(*vma)->vm_end - (*vma)->vm_start);</font></tt>
<br><tt><font size=2>+
return -EINVAL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> (*vma)->vm_page_prot
= pgprot_noncached((*vma)->vm_page_prot);</font></tt>
<br><tt><font size=2> (*vma)->vm_flags
|= VM_IO | VM_RESERVED;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(6, "vsize=%lx
physical=%lx", vsize, physical);</font></tt>
<br><tt><font size=2> ret = remap_pfn_range((*vma),
(*vma)->vm_start,</font></tt>
<br><tt><font size=2>
physical >> PAGE_SHIFT, vsize,</font></tt>
<br><tt><font size=2>
(*vma)->vm_page_prot);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "remap_pfn_range() failed ret=%x",
ret);</font></tt>
<br><tt><font size=2>-
ret = -ENOMEM;</font></tt>
<br><tt><font size=2>+
ehca_gen_err("remap_pfn_range() failed ret=%x",
ret);</font></tt>
<br><tt><font size=2>+
return -ENOMEM;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/hcp_if.c
linux-2.6/drivers/infiniband/hw/ehca/hcp_if.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/hcp_if.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/hcp_if.c
2006-08-30 20:00:17.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -41,13 +41,12 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "hcpi"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include <asm/hvcall.h></font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2> #include "hcp_if.h"</font></tt>
<br><tt><font size=2> #include "hcp_phyp.h"</font></tt>
<br><tt><font size=2> #include "hipz_fns.h"</font></tt>
<br><tt><font size=2>+#include "ipz_pt_fn.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #define H_ALL_RES_QP_ENHANCED_OPS
EHCA_BMASK_IBM(9,11)</font></tt>
<br><tt><font size=2> #define H_ALL_RES_QP_PTE_PIN
EHCA_BMASK_IBM(12,12)</font></tt>
<br><tt><font size=2>@@ -112,12 +111,12 @@ static long ehca_hcall_7arg_7ret(unsigne</font></tt>
<br><tt><font size=2>
unsigned long *out6,</font></tt>
<br><tt><font size=2>
unsigned long *out7)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- long ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ long ret;</font></tt>
<br><tt><font size=2> int i, sleep_msecs;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "opcode=%lx
arg1=%lx arg2=%lx arg3=%lx arg4=%lx arg5=%lx"</font></tt>
<br><tt><font size=2>-
" arg6=%lx arg7=%lx", opcode, arg1, arg2, arg3,
arg4, arg5,</font></tt>
<br><tt><font size=2>-
arg6, arg7);</font></tt>
<br><tt><font size=2>+ ehca_gen_dbg("opcode=%lx
arg1=%lx arg2=%lx arg3=%lx arg4=%lx arg5=%lx "</font></tt>
<br><tt><font size=2>+
"arg6=%lx arg7=%lx", opcode,
arg1, arg2, arg3, arg4, arg5,</font></tt>
<br><tt><font size=2>+
arg6, arg7);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> for (i =
0; i < 5; i++) {</font></tt>
<br><tt><font size=2>
ret = plpar_hcall_7arg_7ret(opcode,</font></tt>
<br><tt><font size=2>@@ -133,26 +132,24 @@ static long ehca_hcall_7arg_7ret(unsigne</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (ret < H_SUCCESS)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "opcode=%lx
ret=%lx"</font></tt>
<br><tt><font size=2>-
" arg1=%lx arg2=%lx arg3=%lx arg4=%lx"</font></tt>
<br><tt><font size=2>-
" arg5=%lx arg6=%lx arg7=%lx"</font></tt>
<br><tt><font size=2>-
" out1=%lx out2=%lx out3=%lx out4=%lx"</font></tt>
<br><tt><font size=2>-
" out5=%lx out6=%lx out7=%lx",</font></tt>
<br><tt><font size=2>-
opcode, ret,</font></tt>
<br><tt><font size=2>-
arg1, arg2, arg3, arg4,</font></tt>
<br><tt><font size=2>-
arg5, arg6, arg7,</font></tt>
<br><tt><font size=2>-
*out1, *out2, *out3, *out4,</font></tt>
<br><tt><font size=2>-
*out5, *out6, *out7);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "opcode=%lx ret=%lx out1=%lx out2=%lx
out3=%lx "</font></tt>
<br><tt><font size=2>-
"out4=%lx
out5=%lx out6=%lx out7=%lx",</font></tt>
<br><tt><font size=2>-
opcode, ret, *out1,
*out2, *out3, *out4, *out5,</font></tt>
<br><tt><font size=2>-
*out6, *out7);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("opcode=%lx
ret=%lx"</font></tt>
<br><tt><font size=2>+
" arg1=%lx arg2=%lx arg3=%lx arg4=%lx"</font></tt>
<br><tt><font size=2>+
" arg5=%lx arg6=%lx arg7=%lx"</font></tt>
<br><tt><font size=2>+
" out1=%lx out2=%lx out3=%lx out4=%lx"</font></tt>
<br><tt><font size=2>+
" out5=%lx out6=%lx out7=%lx",</font></tt>
<br><tt><font size=2>+
opcode, ret,</font></tt>
<br><tt><font size=2>+
arg1, arg2, arg3, arg4,</font></tt>
<br><tt><font size=2>+
arg5, arg6, arg7,</font></tt>
<br><tt><font size=2>+
*out1, *out2, *out3, *out4,</font></tt>
<br><tt><font size=2>+
*out5, *out6, *out7);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("opcode=%lx ret=%lx out1=%lx out2=%lx
out3=%lx "</font></tt>
<br><tt><font size=2>+
"out4=%lx out5=%lx out6=%lx out7=%lx",</font></tt>
<br><tt><font size=2>+
opcode, ret, *out1, *out2, *out3, *out4, *out5,</font></tt>
<br><tt><font size=2>+
*out6, *out7);</font></tt>
<br><tt><font size=2>
return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "opcode=%lx
ret=H_BUSY", opcode);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return H_BUSY;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -176,14 +173,13 @@ static long ehca_hcall_9arg_9ret(unsigne</font></tt>
<br><tt><font size=2>
unsigned long *out8,</font></tt>
<br><tt><font size=2>
unsigned long *out9)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- long ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ long ret;</font></tt>
<br><tt><font size=2> int i, sleep_msecs;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "opcode=%lx
arg1=%lx arg2=%lx arg3=%lx arg4=%lx "</font></tt>
<br><tt><font size=2>-
"arg5=%lx arg6=%lx arg7=%lx arg8=%lx arg9=%lx",</font></tt>
<br><tt><font size=2>-
opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7,</font></tt>
<br><tt><font size=2>-
arg8, arg9);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+ ehca_gen_dbg("opcode=%lx
arg1=%lx arg2=%lx arg3=%lx arg4=%lx "</font></tt>
<br><tt><font size=2>+
"arg5=%lx arg6=%lx arg7=%lx arg8=%lx
arg9=%lx",</font></tt>
<br><tt><font size=2>+
opcode, arg1, arg2, arg3, arg4, arg5,
arg6, arg7,</font></tt>
<br><tt><font size=2>+
arg8, arg9);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> for (i =
0; i < 5; i++) {</font></tt>
<br><tt><font size=2>
ret = plpar_hcall_9arg_9ret(opcode,</font></tt>
<br><tt><font size=2>@@ -201,32 +197,32 @@ static long ehca_hcall_9arg_9ret(unsigne</font></tt>
<br><tt><font size=2>
}</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>
if (ret < H_SUCCESS)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "opcode=%lx
ret=%lx"</font></tt>
<br><tt><font size=2>-
" arg1=%lx arg2=%lx arg3=%lx arg4=%lx"</font></tt>
<br><tt><font size=2>-
" arg5=%lx arg6=%lx arg7=%lx arg8=%lx"</font></tt>
<br><tt><font size=2>-
" arg9=%lx"</font></tt>
<br><tt><font size=2>-
" out1=%lx out2=%lx out3=%lx out4=%lx"</font></tt>
<br><tt><font size=2>-
" out5=%lx out6=%lx out7=%lx out8=%lx"</font></tt>
<br><tt><font size=2>-
" out9=%lx",</font></tt>
<br><tt><font size=2>-
opcode, ret,</font></tt>
<br><tt><font size=2>-
arg1, arg2, arg3, arg4,</font></tt>
<br><tt><font size=2>-
arg5, arg6, arg7, arg8,</font></tt>
<br><tt><font size=2>-
arg9,</font></tt>
<br><tt><font size=2>-
*out1, *out2, *out3, *out4,</font></tt>
<br><tt><font size=2>-
*out5, *out6, *out7, *out8,</font></tt>
<br><tt><font size=2>-
*out9);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>-
EDEB_EX(7, "opcode=%lx ret=%lx out1=%lx out2=%lx
out3=%lx "</font></tt>
<br><tt><font size=2>-
"out4=%lx
out5=%lx out6=%lx out7=%lx out8=%lx out9=%lx",</font></tt>
<br><tt><font size=2>-
opcode, ret,*out1,
*out2, *out3, *out4, *out5, *out6,</font></tt>
<br><tt><font size=2>-
*out7, *out8,
*out9);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("opcode=%lx
ret=%lx"</font></tt>
<br><tt><font size=2>+
" arg1=%lx arg2=%lx arg3=%lx arg4=%lx"</font></tt>
<br><tt><font size=2>+
" arg5=%lx arg6=%lx arg7=%lx arg8=%lx"</font></tt>
<br><tt><font size=2>+
" arg9=%lx"</font></tt>
<br><tt><font size=2>+
" out1=%lx out2=%lx out3=%lx out4=%lx"</font></tt>
<br><tt><font size=2>+
" out5=%lx out6=%lx out7=%lx out8=%lx"</font></tt>
<br><tt><font size=2>+
" out9=%lx",</font></tt>
<br><tt><font size=2>+
opcode, ret,</font></tt>
<br><tt><font size=2>+
arg1, arg2, arg3, arg4,</font></tt>
<br><tt><font size=2>+
arg5, arg6, arg7, arg8,</font></tt>
<br><tt><font size=2>+
arg9,</font></tt>
<br><tt><font size=2>+
*out1, *out2, *out3, *out4,</font></tt>
<br><tt><font size=2>+
*out5, *out6, *out7, *out8,</font></tt>
<br><tt><font size=2>+
*out9);</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("opcode=%lx ret=%lx out1=%lx out2=%lx
out3=%lx "</font></tt>
<br><tt><font size=2>+
"out4=%lx out5=%lx out6=%lx out7=%lx out8=%lx "</font></tt>
<br><tt><font size=2>+
"out9=%lx", opcode, ret,*out1, *out2, *out3, *out4,</font></tt>
<br><tt><font size=2>+
*out5, *out6, *out7, *out8, *out9);</font></tt>
<br><tt><font size=2>
return ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "opcode=%lx
ret=H_BUSY", opcode);</font></tt>
<br><tt><font size=2> return H_BUSY;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
struct ehca_pfeq *pfeq,</font></tt>
<br><tt><font size=2>
const u32 neq_control,</font></tt>
<br><tt><font size=2>@@ -236,18 +232,10 @@ u64 hipz_h_alloc_resource_eq(const
struc</font></tt>
<br><tt><font size=2>
u32 * act_pages,</font></tt>
<br><tt><font size=2>
u32 * eq_ist)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 act_nr_of_entries_out
= 0;</font></tt>
<br><tt><font size=2>- u64 act_pages_out
= 0;</font></tt>
<br><tt><font size=2>- u64 eq_ist_out
= 0;</font></tt>
<br><tt><font size=2>- u64 allocate_controls
= 0;</font></tt>
<br><tt><font size=2>- u32 x = (u64)(&x);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pfeq=%p
adapter_handle=%lx new_control=%x"</font></tt>
<br><tt><font size=2>-
" number_of_entries=%x",</font></tt>
<br><tt><font size=2>-
pfeq, adapter_handle.handle, neq_control,</font></tt>
<br><tt><font size=2>-
number_of_entries);</font></tt>
<br><tt><font size=2>+ u64 allocate_controls;</font></tt>
<br><tt><font size=2>+ u64 act_nr_of_entries_out,
act_pages_out, eq_ist_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> /* resource
type */</font></tt>
<br><tt><font size=2> allocate_controls
= 3ULL;</font></tt>
<br><tt><font size=2>@@ -276,10 +264,7 @@ u64 hipz_h_alloc_resource_eq(const
struc</font></tt>
<br><tt><font size=2> *eq_ist
= (u32)eq_ist_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_NOT_ENOUGH_RESOURCES)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Not enough resource - ret=%lx ",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "act_nr_of_entries=%x
act_pages=%x eq_ist=%x",</font></tt>
<br><tt><font size=2>-
*act_nr_of_entries, *act_pages, *eq_ist);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Not enough resource - ret=%lx ",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -288,45 +273,30 @@ u64 hipz_h_reset_event(const
struct ipz_</font></tt>
<br><tt><font size=2>
struct ipz_eq_handle
eq_handle,</font></tt>
<br><tt><font size=2>
const u64 event_mask)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "eq_handle=%lx,
adapter_handle=%lx event_mask=%lx",</font></tt>
<br><tt><font size=2>-
eq_handle.handle, adapter_handle.handle, event_mask);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_RESET_EVENTS,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>-
eq_handle.handle, /* r5
*/</font></tt>
<br><tt><font size=2>-
event_mask,
/* r6 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_RESET_EVENTS,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>+
eq_handle.handle, /*
r5 */</font></tt>
<br><tt><font size=2>+
event_mask,
/* r6 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_alloc_resource_cq(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
struct ehca_cq *cq,</font></tt>
<br><tt><font size=2>
struct ehca_alloc_cq_parms *param)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 act_nr_of_entries_out;</font></tt>
<br><tt><font size=2>- u64 act_pages_out;</font></tt>
<br><tt><font size=2>- u64 g_la_privileged_out;</font></tt>
<br><tt><font size=2>- u64 g_la_user_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "Adapter_handle=%lx
eq_handle=%lx cq_token=%x"</font></tt>
<br><tt><font size=2>-
" cq_number_of_entries=%x",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, param->eq_handle.handle,</font></tt>
<br><tt><font size=2>-
cq->token, param->nr_cqe);</font></tt>
<br><tt><font size=2>+ u64 act_nr_of_entries_out,
act_pages_out;</font></tt>
<br><tt><font size=2>+ u64 g_la_privileged_out,
g_la_user_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_ALLOC_RESOURCE,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>@@ -350,10 +320,7 @@ u64 hipz_h_alloc_resource_cq(const
struc</font></tt>
<br><tt><font size=2>
hcp_galpas_ctor(&cq->galpas, g_la_privileged_out,
g_la_user_out);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_NOT_ENOUGH_RESOURCES)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Not enough resources. ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq_handle=%lx
act_nr_of_entries=%x act_pages=%x",</font></tt>
<br><tt><font size=2>-
cq->ipz_cq_handle.handle, param->act_nr_of_entries,
param->act_pages);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Not enough resources. ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -362,32 +329,13 @@ u64 hipz_h_alloc_resource_qp(const
struc</font></tt>
<br><tt><font size=2>
struct ehca_qp *qp,</font></tt>
<br><tt><font size=2>
struct ehca_alloc_qp_parms *parms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u64 allocate_controls;</font></tt>
<br><tt><font size=2>- u64 max_r10_reg;</font></tt>
<br><tt><font size=2>- u64 dummy
= 0;</font></tt>
<br><tt><font size=2>- u64 qp_nr_out
= 0;</font></tt>
<br><tt><font size=2>- u64 r6_out
= 0;</font></tt>
<br><tt><font size=2>- u64 r7_out
= 0;</font></tt>
<br><tt><font size=2>- u64 r8_out
= 0;</font></tt>
<br><tt><font size=2>- u64 g_la_user_out
= 0;</font></tt>
<br><tt><font size=2>- u64 r11_out
= 0;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2>+ u64 dummy, allocate_controls,
max_r10_reg;</font></tt>
<br><tt><font size=2>+ u64 qp_nr_out,
r6_out, r7_out, r8_out, g_la_user_out, r11_out;</font></tt>
<br><tt><font size=2> u16 max_nr_receive_wqes
= qp->init_attr.cap.max_recv_wr + 1;</font></tt>
<br><tt><font size=2> u16 max_nr_send_wqes
= qp->init_attr.cap.max_send_wr + 1;</font></tt>
<br><tt><font size=2> int daqp_ctrl
= parms->daqp_ctrl;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "Adapter_handle=%lx
servicetype=%x signalingtype=%x"</font></tt>
<br><tt><font size=2>-
" ud_av_l_key=%x send_cq_handle=%lx receive_cq_handle=%lx"</font></tt>
<br><tt><font size=2>-
" async_eq_handle=%lx qp_token=%x pd=%x max_nr_send_wqes=%x"</font></tt>
<br><tt><font size=2>-
" max_nr_receive_wqes=%x max_nr_send_sges=%x"</font></tt>
<br><tt><font size=2>-
" max_nr_receive_sges=%x ud_av_l_key=%x galpa.pid=%x",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, parms->servicetype, parms->sigtype,</font></tt>
<br><tt><font size=2>-
parms->ud_av_l_key_ctl, qp->send_cq->ipz_cq_handle.handle,</font></tt>
<br><tt><font size=2>-
qp->recv_cq->ipz_cq_handle.handle, parms->ipz_eq_handle.handle,</font></tt>
<br><tt><font size=2>-
qp->token, parms->pd.value, max_nr_send_wqes,</font></tt>
<br><tt><font size=2>-
max_nr_receive_wqes, parms->max_send_sge, parms->max_recv_sge,</font></tt>
<br><tt><font size=2>-
parms->ud_av_l_key_ctl, qp->galpas.pid);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> allocate_controls
=</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(H_ALL_RES_QP_ENHANCED_OPS,</font></tt>
<br><tt><font size=2>
(daqp_ctrl & DAQP_CTRL_ENABLE) ? 1 : 0)</font></tt>
<br><tt><font size=2>@@ -453,17 +401,7 @@ u64 hipz_h_alloc_resource_qp(const
struc</font></tt>
<br><tt><font size=2>
hcp_galpas_ctor(&qp->galpas, g_la_user_out,
g_la_user_out);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_NOT_ENOUGH_RESOURCES)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Not enough resources. ret=%lx",ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "qp_nr=%x
act_nr_send_wqes=%x"</font></tt>
<br><tt><font size=2>-
" act_nr_receive_wqes=%x act_nr_send_sges=%x"</font></tt>
<br><tt><font size=2>-
" act_nr_receive_sges=%x nr_sq_pages=%x"</font></tt>
<br><tt><font size=2>-
" nr_rq_pages=%x galpa.user=%lx galpa.kernel=%lx",</font></tt>
<br><tt><font size=2>-
qp->real_qp_num, parms->act_nr_send_wqes,</font></tt>
<br><tt><font size=2>-
parms->act_nr_recv_wqes, parms->act_nr_send_sges,</font></tt>
<br><tt><font size=2>-
parms->act_nr_recv_sges, parms->nr_sq_pages,</font></tt>
<br><tt><font size=2>-
parms->nr_rq_pages, qp->galpas.user.fw_handle,</font></tt>
<br><tt><font size=2>-
qp->galpas.kernel.fw_handle);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Not enough resources. ret=%lx",ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -472,20 +410,15 @@ u64 hipz_h_query_port(const
struct ipz_a</font></tt>
<br><tt><font size=2>
const u8 port_id,</font></tt>
<br><tt><font size=2>
struct hipz_query_port
*query_port_response_block)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 r_cb;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
port_id %x",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, port_id);</font></tt>
<br><tt><font size=2>+ u64 r_cb = virt_to_abs(query_port_response_block);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (((u64)query_port_response_block)
& 0xfff) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "response block not page aligned");</font></tt>
<br><tt><font size=2>+ if (r_cb &
(EHCA_PAGESIZE-1)) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("response block not page aligned");</font></tt>
<br><tt><font size=2>
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- r_cb = virt_to_abs(query_port_response_block);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_QUERY_PORT,</font></tt>
<br><tt><font size=2>
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>
port_id,
/* r5 */</font></tt>
<br><tt><font size=2>@@ -499,19 +432,8 @@ u64 hipz_h_query_port(const struct
ipz_a</font></tt>
<br><tt><font size=2>
&dummy,</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_DMP(7, query_port_response_block,
64, "query_port_response_block");</font></tt>
<br><tt><font size=2>- EDEB(7, "offset31=%x
offset35=%x offset36=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[32],</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[36],</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[37]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offset200=%x
offset201=%x offset202=%x "</font></tt>
<br><tt><font size=2>-
"offset203=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[0x200],</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[0x201],</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[0x202],</font></tt>
<br><tt><font size=2>-
((u32*)query_port_response_block)[0x203]);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>+ if (ehca_debug_level)</font></tt>
<br><tt><font size=2>+
ehca_dmp(query_port_response_block, 64, "response_block");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -519,62 +441,26 @@ u64 hipz_h_query_port(const
struct ipz_a</font></tt>
<br><tt><font size=2> u64 hipz_h_query_hca(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
struct hipz_query_hca *query_hca_rblock)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 r_cb;</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx",
adapter_handle.handle);</font></tt>
<br><tt><font size=2>+ u64 r_cb = virt_to_abs(query_hca_rblock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (((u64)query_hca_rblock)
& 0xfff) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "response_block=%p not page aligned",</font></tt>
<br><tt><font size=2>-
query_hca_rblock);</font></tt>
<br><tt><font size=2>+ if (r_cb &
(EHCA_PAGESIZE-1)) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("response_block=%p not page aligned",</font></tt>
<br><tt><font size=2>+
query_hca_rblock);</font></tt>
<br><tt><font size=2>
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- r_cb = virt_to_abs(query_hca_rblock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_QUERY_HCA,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>-
r_cb,
/* r5 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB(7, "offset0=%x
offset1=%x offset2=%x offset3=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[0],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[1],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[2], ((u32*)query_hca_rblock)[3]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offset4=%x
offset5=%x offset6=%x offset7=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[4],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[5],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[6], ((u32*)query_hca_rblock)[7]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offset8=%x
offset9=%x offseta=%x offsetb=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[8],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[9],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[10], ((u32*)query_hca_rblock)[11]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offsetc=%x
offsetd=%x offsete=%x offsetf=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[12],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[13],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[14], ((u32*)query_hca_rblock)[15]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offset136=%x
offset192=%x offset204=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[32],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[48], ((u32*)query_hca_rblock)[51]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offset231=%x
offset235=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[57], ((u32*)query_hca_rblock)[58]);</font></tt>
<br><tt><font size=2>- EDEB(7, "offset200=%x
offset201=%x offset202=%x offset203=%x",</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[0x201],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[0x202],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[0x203],</font></tt>
<br><tt><font size=2>-
((u32*)query_hca_rblock)[0x204]);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
adapter_handle=%lx",</font></tt>
<br><tt><font size=2>-
ret, adapter_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_QUERY_HCA,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>+
r_cb,
/* r5 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_register_rpage(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -584,32 +470,22 @@ u64 hipz_h_register_rpage(const
struct i</font></tt>
<br><tt><font size=2>
const
u64 logical_address_of_page,</font></tt>
<br><tt><font size=2>
u64
count)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
pagesize=%x queue_type=%x"</font></tt>
<br><tt><font size=2>-
" resource_handle=%lx logical_address_of_page=%lx
count=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, pagesize, queue_type,</font></tt>
<br><tt><font size=2>-
resource_handle, logical_address_of_page, count);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_REGISTER_RPAGES,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /*
r4 */</font></tt>
<br><tt><font size=2>-
queue_type | pagesize << 8, /* r5 */</font></tt>
<br><tt><font size=2>-
resource_handle,
/* r6 */</font></tt>
<br><tt><font size=2>-
logical_address_of_page, /* r7
*/</font></tt>
<br><tt><font size=2>-
count,
/* r8 */</font></tt>
<br><tt><font size=2>-
0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_REGISTER_RPAGES,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>+
queue_type | pagesize << 8, /*
r5 */</font></tt>
<br><tt><font size=2>+
resource_handle,
/* r6 */</font></tt>
<br><tt><font size=2>+
logical_address_of_page, /*
r7 */</font></tt>
<br><tt><font size=2>+
count,
/* r8 */</font></tt>
<br><tt><font size=2>+
0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_register_rpage_eq(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -620,34 +496,22 @@ u64 hipz_h_register_rpage_eq(const
struc</font></tt>
<br><tt><font size=2>
const u64 logical_address_of_page,</font></tt>
<br><tt><font size=2>
const u64 count)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pfeq=%p
adapter_handle=%lx eq_handle=%lx pagesize=%x"</font></tt>
<br><tt><font size=2>-
" queue_type=%x logical_address_of_page=%lx count=%lx",</font></tt>
<br><tt><font size=2>-
pfeq, adapter_handle.handle, eq_handle.handle, pagesize,</font></tt>
<br><tt><font size=2>-
queue_type,logical_address_of_page, count);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (count
!= 1) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Ppage counter=%lx", count);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Ppage counter=%lx", count);</font></tt>
<br><tt><font size=2>
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- ret = hipz_h_register_rpage(adapter_handle,</font></tt>
<br><tt><font size=2>-
pagesize,</font></tt>
<br><tt><font size=2>-
queue_type,</font></tt>
<br><tt><font size=2>-
eq_handle.handle,</font></tt>
<br><tt><font size=2>-
logical_address_of_page, count);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return hipz_h_register_rpage(adapter_handle,</font></tt>
<br><tt><font size=2>+
pagesize,</font></tt>
<br><tt><font size=2>+
queue_type,</font></tt>
<br><tt><font size=2>+
eq_handle.handle,</font></tt>
<br><tt><font size=2>+
logical_address_of_page, count);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u32 hipz_h_query_int_state(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
u32 ist)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u32 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u64 dummy = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ist=%x",
ist);</font></tt>
<br><tt><font size=2>+ u32 ret;</font></tt>
<br><tt><font size=2>+ u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_QUERY_INT_STATE,</font></tt>
<br><tt><font size=2>
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>@@ -662,9 +526,7 @@ u32 hipz_h_query_int_state(const
struct </font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
!= H_SUCCESS && ret != H_BUSY)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not query interrupt state.");</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "interrupt
state: %x", ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Could not query interrupt state.");</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -678,24 +540,14 @@ u64 hipz_h_register_rpage_cq(const
struc</font></tt>
<br><tt><font size=2>
const u64 count,</font></tt>
<br><tt><font size=2>
const struct h_galpa gal)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pfcq=%p
adapter_handle=%lx cq_handle=%lx pagesize=%x"</font></tt>
<br><tt><font size=2>-
" queue_type=%x logical_address_of_page=%lx count=%lx",</font></tt>
<br><tt><font size=2>-
pfcq, adapter_handle.handle, cq_handle.handle, pagesize,</font></tt>
<br><tt><font size=2>-
queue_type, logical_address_of_page, count);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (count
!= 1) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Page counter=%lx", count);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Page counter=%lx", count);</font></tt>
<br><tt><font size=2>
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ret = hipz_h_register_rpage(adapter_handle,
pagesize, queue_type,</font></tt>
<br><tt><font size=2>-
cq_handle.handle, logical_address_of_page,</font></tt>
<br><tt><font size=2>-
count);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return hipz_h_register_rpage(adapter_handle,
pagesize, queue_type,</font></tt>
<br><tt><font size=2>+
cq_handle.handle, logical_address_of_page,</font></tt>
<br><tt><font size=2>+
count);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_register_rpage_qp(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -707,24 +559,14 @@ u64 hipz_h_register_rpage_qp(const
struc</font></tt>
<br><tt><font size=2>
const u64 count,</font></tt>
<br><tt><font size=2>
const struct h_galpa galpa)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pfqp=%p
adapter_handle=%lx qp_handle=%lx pagesize=%x"</font></tt>
<br><tt><font size=2>-
" queue_type=%x logical_address_of_page=%lx count=%lx",</font></tt>
<br><tt><font size=2>-
pfqp, adapter_handle.handle, qp_handle.handle, pagesize,</font></tt>
<br><tt><font size=2>-
queue_type, logical_address_of_page, count);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (count
!= 1) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Page counter=%lx", count);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Page counter=%lx", count);</font></tt>
<br><tt><font size=2>
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ret = hipz_h_register_rpage(adapter_handle,pagesize,queue_type,</font></tt>
<br><tt><font size=2>-
qp_handle.handle,logical_address_of_page,</font></tt>
<br><tt><font size=2>-
count);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return hipz_h_register_rpage(adapter_handle,pagesize,queue_type,</font></tt>
<br><tt><font size=2>+
qp_handle.handle,logical_address_of_page,</font></tt>
<br><tt><font size=2>+
count);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_disable_and_get_wqe(const struct
ipz_adapter_handle adapter_handle,</font></tt>
<br><tt><font size=2>@@ -734,36 +576,25 @@ u64 hipz_h_disable_and_get_wqe(const
str</font></tt>
<br><tt><font size=2>
void **log_addr_next_rq_wqe2processed,</font></tt>
<br><tt><font size=2>
int dis_and_get_function_code)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u8 function_code
= 1;</font></tt>
<br><tt><font size=2> u64 dummy,
dummy1, dummy2;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pfqp=%p
adapter_handle=%lx function=%x qp_handle=%lx",</font></tt>
<br><tt><font size=2>-
pfqp, adapter_handle.handle, function_code, qp_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> if (!log_addr_next_sq_wqe2processed)</font></tt>
<br><tt><font size=2>
log_addr_next_sq_wqe2processed = (void**)&dummy1;</font></tt>
<br><tt><font size=2> if (!log_addr_next_rq_wqe2processed)</font></tt>
<br><tt><font size=2>
log_addr_next_rq_wqe2processed = (void**)&dummy2;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_DISABLE_AND_GETC,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4
*/</font></tt>
<br><tt><font size=2>-
dis_and_get_function_code, /* r5 */</font></tt>
<br><tt><font size=2>-
qp_handle.handle,
/* r6 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
(void*)log_addr_next_sq_wqe2processed,</font></tt>
<br><tt><font size=2>-
(void*)log_addr_next_rq_wqe2processed,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
ladr_next_rq_wqe_out=%p"</font></tt>
<br><tt><font size=2>-
" ladr_next_sq_wqe_out=%p", ret,</font></tt>
<br><tt><font size=2>-
*log_addr_next_sq_wqe2processed,</font></tt>
<br><tt><font size=2>-
*log_addr_next_rq_wqe2processed);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_DISABLE_AND_GETC,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>+
dis_and_get_function_code, /* r5 */</font></tt>
<br><tt><font size=2>+
qp_handle.handle,
/* r6 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
(void*)log_addr_next_sq_wqe2processed,</font></tt>
<br><tt><font size=2>+
(void*)log_addr_next_rq_wqe2processed,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_modify_qp(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -773,22 +604,15 @@ u64 hipz_h_modify_qp(const struct
ipz_ad</font></tt>
<br><tt><font size=2>
struct hcp_modify_qp_control_block
*mqpcb,</font></tt>
<br><tt><font size=2>
struct h_galpa gal)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>- u64 invalid_attribute_identifier
= 0;</font></tt>
<br><tt><font size=2>- u64 rc_attrib_mask
= 0;</font></tt>
<br><tt><font size=2>- u64 dummy;</font></tt>
<br><tt><font size=2>- u64 r_cb;</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "pfqp=%p
adapter_handle=%lx qp_handle=%lx"</font></tt>
<br><tt><font size=2>-
" update_mask=%lx qp_state=%x mqpcb=%p",</font></tt>
<br><tt><font size=2>-
pfqp, adapter_handle.handle, qp_handle.handle,</font></tt>
<br><tt><font size=2>-
update_mask, mqpcb->qp_state, mqpcb);</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2>+ u64 dummy;</font></tt>
<br><tt><font size=2>+ u64 invalid_attribute_identifier,
rc_attrib_mask;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- r_cb = virt_to_abs(mqpcb);</font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_MODIFY_QP,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>
qp_handle.handle,
/* r5 */</font></tt>
<br><tt><font size=2>
update_mask,
/* r6 */</font></tt>
<br><tt><font size=2>-
r_cb,
/* r7 */</font></tt>
<br><tt><font size=2>+
virt_to_abs(mqpcb),
/* r7 */</font></tt>
<br><tt><font size=2>
0, 0, 0,</font></tt>
<br><tt><font size=2>
&invalid_attribute_identifier,
/* r4 */</font></tt>
<br><tt><font size=2>
&dummy,
/* r5 */</font></tt>
<br><tt><font size=2>@@ -797,12 +621,9 @@ u64 hipz_h_modify_qp(const struct
ipz_ad</font></tt>
<br><tt><font size=2>
&dummy,
/* r8 */</font></tt>
<br><tt><font size=2>
&rc_attrib_mask,
/* r9 */</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2>- if (ret == H_NOT_ENOUGH_RESOURCES)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Insufficient resources ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
invalid_attribute_identifier=%lx"</font></tt>
<br><tt><font size=2>-
" invalid_attribute_MASK=%lx", ret,</font></tt>
<br><tt><font size=2>-
invalid_attribute_identifier, rc_attrib_mask);</font></tt>
<br><tt><font size=2>+ if (ret == H_NOT_ENOUGH_RESOURCES)</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Insufficient resources ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -813,47 +634,32 @@ u64 hipz_h_query_qp(const struct
ipz_ada</font></tt>
<br><tt><font size=2>
struct hcp_modify_qp_control_block
*qqpcb,</font></tt>
<br><tt><font size=2>
struct h_galpa gal)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 r_cb;</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
qp_handle=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, qp_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- r_cb = virt_to_abs(qqpcb);</font></tt>
<br><tt><font size=2>- EDEB(7, "r_cb=%lx",
r_cb);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_QUERY_QP,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>-
qp_handle.handle, /* r5
*/</font></tt>
<br><tt><font size=2>-
r_cb,
/* r6 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_QUERY_QP,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>+
qp_handle.handle, /*
r5 */</font></tt>
<br><tt><font size=2>+
virt_to_abs(qqpcb),
/* r6 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_destroy_qp(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
struct ehca_qp *qp)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 ladr_next_sq_wqe_out;</font></tt>
<br><tt><font size=2>- u64 ladr_next_rq_wqe_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "qp=%p
ipz_qp_handle=%lx adapter_handle=%lx",</font></tt>
<br><tt><font size=2>-
qp, qp->ipz_qp_handle.handle, adapter_handle.handle);</font></tt>
<br><tt><font size=2>+ u64 ladr_next_sq_wqe_out,
ladr_next_rq_wqe_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = hcp_galpas_dtor(&qp->galpas);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not destruct qp->galpas");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Could not destruct qp->galpas");</font></tt>
<br><tt><font size=2>
return H_RESOURCE;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_DISABLE_AND_GETC,</font></tt>
<br><tt><font size=2>@@ -870,7 +676,7 @@ u64 hipz_h_destroy_qp(const struct
ipz_a</font></tt>
<br><tt><font size=2>
&dummy,</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> if (ret
== H_HARDWARE)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "HCA not operational. ret=%lx",
ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("HCA not operational. ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_FREE_RESOURCE,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>@@ -885,9 +691,7 @@ u64 hipz_h_destroy_qp(const struct
ipz_a</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_RESOURCE)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Resource still in use. ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Resource still in use. ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -897,28 +701,20 @@ u64 hipz_h_define_aqp0(const
struct ipz_</font></tt>
<br><tt><font size=2>
struct h_galpa gal,</font></tt>
<br><tt><font size=2>
u32 port)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x
ipz_qp_handle=%lx adapter_handle=%lx",</font></tt>
<br><tt><font size=2>-
port, qp_handle.handle, adapter_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_DEFINE_AQP0,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>-
qp_handle.handle, /* r5
*/</font></tt>
<br><tt><font size=2>-
port,
/* r6 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_DEFINE_AQP0,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>+
qp_handle.handle, /*
r5 */</font></tt>
<br><tt><font size=2>+
port,
/* r6 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_define_aqp1(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -927,13 +723,9 @@ u64 hipz_h_define_aqp1(const
struct ipz_</font></tt>
<br><tt><font size=2>
u32 port, u32 * pma_qp_nr,</font></tt>
<br><tt><font size=2>
u32 * bma_qp_nr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 pma_qp_nr_out;</font></tt>
<br><tt><font size=2>- u64 bma_qp_nr_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "port=%x
qp_handle=%lx adapter_handle=%lx",</font></tt>
<br><tt><font size=2>-
port, qp_handle.handle, adapter_handle.handle);</font></tt>
<br><tt><font size=2>+ u64 pma_qp_nr_out,
bma_qp_nr_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_DEFINE_AQP1,</font></tt>
<br><tt><font size=2>
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>@@ -952,10 +744,7 @@ u64 hipz_h_define_aqp1(const
struct ipz_</font></tt>
<br><tt><font size=2> *bma_qp_nr
= (u32)bma_qp_nr_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_ALIAS_EXIST)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "AQP1 already exists. ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
pma_qp_nr=%i bma_qp_nr=%i",</font></tt>
<br><tt><font size=2>-
ret, (int)*pma_qp_nr, (int)*bma_qp_nr);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("AQP1 already exists. ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -966,23 +755,8 @@ u64 hipz_h_attach_mcqp(const
struct ipz_</font></tt>
<br><tt><font size=2>
u16 mcg_dlid,</font></tt>
<br><tt><font size=2>
u64 subnet_prefix, u64
interface_id)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u8 *dgid_sp =
(u8*)&subnet_prefix;</font></tt>
<br><tt><font size=2>- u8 *dgid_ii =
(u8*)&interface_id;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "qp_handle=%lx
adapter_handle=%lx\nMCG_DGID ="</font></tt>
<br><tt><font size=2>-
" %d.%d.%d.%d.%d.%d.%d.%d."</font></tt>
<br><tt><font size=2>-
" %d.%d.%d.%d.%d.%d.%d.%d",</font></tt>
<br><tt><font size=2>-
qp_handle.handle, adapter_handle.handle,</font></tt>
<br><tt><font size=2>-
dgid_sp[0], dgid_sp[1],</font></tt>
<br><tt><font size=2>-
dgid_sp[2], dgid_sp[3],</font></tt>
<br><tt><font size=2>-
dgid_sp[4], dgid_sp[5],</font></tt>
<br><tt><font size=2>-
dgid_sp[6], dgid_sp[7],</font></tt>
<br><tt><font size=2>-
dgid_ii[0], dgid_ii[1],</font></tt>
<br><tt><font size=2>-
dgid_ii[2], dgid_ii[3],</font></tt>
<br><tt><font size=2>-
dgid_ii[4], dgid_ii[5],</font></tt>
<br><tt><font size=2>-
dgid_ii[6], dgid_ii[7]);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_ATTACH_MCQP,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>@@ -1000,9 +774,7 @@ u64 hipz_h_attach_mcqp(const
struct ipz_</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_NOT_ENOUGH_RESOURCES)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Not enough resources. ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Not enough resources. ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1013,56 +785,34 @@ u64 hipz_h_detach_mcqp(const
struct ipz_</font></tt>
<br><tt><font size=2>
u16 mcg_dlid,</font></tt>
<br><tt><font size=2>
u64 subnet_prefix, u64
interface_id)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u8 *dgid_sp =
(u8*)&subnet_prefix;</font></tt>
<br><tt><font size=2>- u8 *dgid_ii =
(u8*)&interface_id;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "qp_handle=%lx
adapter_handle=%lx\nMCG_DGID ="</font></tt>
<br><tt><font size=2>-
" %d.%d.%d.%d.%d.%d.%d.%d."</font></tt>
<br><tt><font size=2>-
" %d.%d.%d.%d.%d.%d.%d.%d",</font></tt>
<br><tt><font size=2>-
qp_handle.handle, adapter_handle.handle,</font></tt>
<br><tt><font size=2>-
dgid_sp[0], dgid_sp[1],</font></tt>
<br><tt><font size=2>-
dgid_sp[2], dgid_sp[3],</font></tt>
<br><tt><font size=2>-
dgid_sp[4], dgid_sp[5],</font></tt>
<br><tt><font size=2>-
dgid_sp[6], dgid_sp[7],</font></tt>
<br><tt><font size=2>-
dgid_ii[0], dgid_ii[1],</font></tt>
<br><tt><font size=2>-
dgid_ii[2], dgid_ii[3],</font></tt>
<br><tt><font size=2>-
dgid_ii[4], dgid_ii[5],</font></tt>
<br><tt><font size=2>-
dgid_ii[6], dgid_ii[7]);</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_DETACH_MCQP,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>-
qp_handle.handle,
/* r5 */</font></tt>
<br><tt><font size=2>-
mcg_dlid,
/* r6 */</font></tt>
<br><tt><font size=2>-
interface_id,
/* r7 */</font></tt>
<br><tt><font size=2>-
subnet_prefix,
/* r8 */</font></tt>
<br><tt><font size=2>-
0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_DETACH_MCQP,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /* r4 */</font></tt>
<br><tt><font size=2>+
qp_handle.handle,
/* r5 */</font></tt>
<br><tt><font size=2>+
mcg_dlid,
/* r6 */</font></tt>
<br><tt><font size=2>+
interface_id,
/* r7 */</font></tt>
<br><tt><font size=2>+
subnet_prefix,
/* r8 */</font></tt>
<br><tt><font size=2>+
0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_destroy_cq(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
struct ehca_cq *cq,</font></tt>
<br><tt><font size=2>
u8 force_flag)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cq->pf=%p
cq=.%p ipz_cq_handle=%lx adapter_handle=%lx",</font></tt>
<br><tt><font size=2>-
&cq->pf, cq, cq->ipz_cq_handle.handle, adapter_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ret = hcp_galpas_dtor(&cq->galpas);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not destruct cp->galpas");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Could not destruct cp->galpas");</font></tt>
<br><tt><font size=2>
return H_RESOURCE;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1080,9 +830,7 @@ u64 hipz_h_destroy_cq(const struct
ipz_a</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_RESOURCE)</font></tt>
<br><tt><font size=2>-
EDEB(4, "ret=%lx ", ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("H_FREE_RESOURCE failed ret=%lx
", ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1090,16 +838,12 @@ u64 hipz_h_destroy_cq(const
struct ipz_a</font></tt>
<br><tt><font size=2> u64 hipz_h_destroy_eq(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
struct ehca_eq *eq)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "eq->pf=%p
eq=%p ipz_eq_handle=%lx adapter_handle=%lx",</font></tt>
<br><tt><font size=2>-
&eq->pf, eq, eq->ipz_eq_handle.handle,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ret = hcp_galpas_dtor(&eq->galpas);</font></tt>
<br><tt><font size=2> if (ret)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Could not destruct eq->galpas");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Could not destruct eq->galpas");</font></tt>
<br><tt><font size=2>
return H_RESOURCE;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1117,9 +861,7 @@ u64 hipz_h_destroy_eq(const struct
ipz_a</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> if (ret
== H_RESOURCE)</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "Resource in use. ret=%lx ",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("Resource in use. ret=%lx ",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1132,16 +874,11 @@ u64 hipz_h_alloc_resource_mr(const
struc</font></tt>
<br><tt><font size=2>
const struct ipz_pd pd,</font></tt>
<br><tt><font size=2>
struct ehca_mr_hipzout_parms *outparms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> u64 lkey_out;</font></tt>
<br><tt><font size=2> u64 rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mr=%p vaddr=%lx length=%lx"</font></tt>
<br><tt><font size=2>-
" access_ctrl=%x pd=%x",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mr, vaddr, length, access_ctrl,</font></tt>
<br><tt><font size=2>-
pd.value);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_ALLOC_RESOURCE,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>
5,
/*
r5 */</font></tt>
<br><tt><font size=2>@@ -1160,9 +897,6 @@ u64 hipz_h_alloc_resource_mr(const
struc</font></tt>
<br><tt><font size=2> outparms->lkey
= (u32)lkey_out;</font></tt>
<br><tt><font size=2> outparms->rkey
= (u32)rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
mr_handle=%lx lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
ret, outparms->handle.handle, outparms->lkey,
outparms->rkey);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1173,27 +907,22 @@ u64 hipz_h_register_rpage_mr(const
struc</font></tt>
<br><tt><font size=2>
const u64 logical_address_of_page,</font></tt>
<br><tt><font size=2>
const u64 count)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mr=%p mr_handle=%lx pagesize=%x"</font></tt>
<br><tt><font size=2>-
" queue_type=%x logical_address_of_page=%lx count=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mr, mr->ipz_mr_handle.handle,
pagesize,</font></tt>
<br><tt><font size=2>-
queue_type, logical_address_of_page, count);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if ((count >
1) && (logical_address_of_page & 0xfff)) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "logical_address_of_page not on a
4k boundary "</font></tt>
<br><tt><font size=2>-
"adapter_handle=%lx
mr=%p mr_handle=%lx "</font></tt>
<br><tt><font size=2>-
"pagesize=%x
queue_type=%x logical_address_of_page=%lx"</font></tt>
<br><tt><font size=2>-
" count=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle,
mr, mr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>-
pagesize, queue_type,
logical_address_of_page, count);</font></tt>
<br><tt><font size=2>+ if ((count >
1) && (logical_address_of_page & (EHCA_PAGESIZE-1))) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("logical_address_of_page not on
a 4k boundary "</font></tt>
<br><tt><font size=2>+
"adapter_handle=%lx mr=%p mr_handle=%lx "</font></tt>
<br><tt><font size=2>+
"pagesize=%x queue_type=%x "</font></tt>
<br><tt><font size=2>+
"logical_address_of_page=%lx count=%lx",</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, mr,</font></tt>
<br><tt><font size=2>+
mr->ipz_mr_handle.handle, pagesize, queue_type,</font></tt>
<br><tt><font size=2>+
logical_address_of_page, count);</font></tt>
<br><tt><font size=2>
ret = H_PARAMETER;</font></tt>
<br><tt><font size=2> } else</font></tt>
<br><tt><font size=2>
ret = hipz_h_register_rpage(adapter_handle,
pagesize,</font></tt>
<br><tt><font size=2>
queue_type,</font></tt>
<br><tt><font size=2>
mr->ipz_mr_handle.handle,</font></tt>
<br><tt><font size=2>
logical_address_of_page, count);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -1202,15 +931,9 @@ u64 hipz_h_query_mr(const struct
ipz_ada</font></tt>
<br><tt><font size=2>
const struct ehca_mr *mr,</font></tt>
<br><tt><font size=2>
struct ehca_mr_hipzout_parms
*outparms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 remote_len_out;</font></tt>
<br><tt><font size=2>- u64 remote_vaddr_out;</font></tt>
<br><tt><font size=2>- u64 acc_ctrl_pd_out;</font></tt>
<br><tt><font size=2>- u64 r9_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mr=%p mr_handle=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mr, mr->ipz_mr_handle.handle);</font></tt>
<br><tt><font size=2>+ u64 remote_len_out,
remote_vaddr_out, acc_ctrl_pd_out, r9_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_QUERY_MR,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>@@ -1228,38 +951,25 @@ u64 hipz_h_query_mr(const struct
ipz_ada</font></tt>
<br><tt><font size=2> outparms->lkey
= (u32)(r9_out >> 32);</font></tt>
<br><tt><font size=2> outparms->rkey
= (u32)(r9_out & (0xffffffff));</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
mr_local_length=%lx mr_local_vaddr=%lx "</font></tt>
<br><tt><font size=2>-
"mr_remote_length=%lx mr_remote_vaddr=%lx access_ctrl=%x
"</font></tt>
<br><tt><font size=2>-
"pd=%x lkey=%x rkey=%x", ret, outparms->len,</font></tt>
<br><tt><font size=2>-
outparms->vaddr, remote_len_out, remote_vaddr_out,</font></tt>
<br><tt><font size=2>-
outparms->acl, outparms->acl, outparms->lkey,
outparms->rkey);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
const struct ehca_mr *mr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mr=%p mr_handle=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mr, mr->ipz_mr_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_FREE_RESOURCE,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4
*/</font></tt>
<br><tt><font size=2>-
mr->ipz_mr_handle.handle, /* r5 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_FREE_RESOURCE,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /*
r4 */</font></tt>
<br><tt><font size=2>+
mr->ipz_mr_handle.handle, /* r5 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -1271,15 +981,9 @@ u64 hipz_h_reregister_pmr(const
struct i</font></tt>
<br><tt><font size=2>
const
u64 mr_addr_cb,</font></tt>
<br><tt><font size=2>
struct
ehca_mr_hipzout_parms *outparms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 lkey_out;</font></tt>
<br><tt><font size=2>- u64 rkey_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mr=%p mr_handle=%lx vaddr_in=%lx "</font></tt>
<br><tt><font size=2>-
"length=%lx access_ctrl=%x pd=%x mr_addr_cb=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mr, mr->ipz_mr_handle.handle,
vaddr_in,</font></tt>
<br><tt><font size=2>-
length, access_ctrl, pd.value, mr_addr_cb);</font></tt>
<br><tt><font size=2>+ u64 lkey_out,
rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_REREGISTER_PMR,</font></tt>
<br><tt><font size=2>
adapter_handle.handle, /*
r4 */</font></tt>
<br><tt><font size=2>@@ -1301,8 +1005,6 @@ u64 hipz_h_reregister_pmr(const
struct i</font></tt>
<br><tt><font size=2> outparms->lkey
= (u32)lkey_out;</font></tt>
<br><tt><font size=2> outparms->rkey
= (u32)rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
vaddr=%lx lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
ret, outparms->vaddr, outparms->lkey, outparms->rkey);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1314,16 +1016,9 @@ u64 hipz_h_register_smr(const
struct ipz</font></tt>
<br><tt><font size=2>
const struct
ipz_pd pd,</font></tt>
<br><tt><font size=2>
struct
ehca_mr_hipzout_parms *outparms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 lkey_out;</font></tt>
<br><tt><font size=2>- u64 rkey_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
orig_mr=%p orig_mr_handle=%lx "</font></tt>
<br><tt><font size=2>-
"vaddr_in=%lx access_ctrl=%x pd=%x", adapter_handle.handle,</font></tt>
<br><tt><font size=2>-
orig_mr, orig_mr->ipz_mr_handle.handle, vaddr_in,
access_ctrl,</font></tt>
<br><tt><font size=2>-
pd.value);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>+ u64 lkey_out,
rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_REGISTER_SMR,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>@@ -1342,9 +1037,6 @@ u64 hipz_h_register_smr(const
struct ipz</font></tt>
<br><tt><font size=2> outparms->lkey
= (u32)lkey_out;</font></tt>
<br><tt><font size=2> outparms->rkey
= (u32)rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
mr_handle=%lx lkey=%x rkey=%x",</font></tt>
<br><tt><font size=2>-
ret, outparms->handle.handle, outparms->lkey,
outparms->rkey);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1353,13 +1045,10 @@ u64 hipz_h_alloc_resource_mw(const
struc</font></tt>
<br><tt><font size=2>
const struct ipz_pd pd,</font></tt>
<br><tt><font size=2>
struct ehca_mw_hipzout_parms *outparms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> u64 rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mw=%p pd=%x",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mw, pd.value);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_ALLOC_RESOURCE,</font></tt>
<br><tt><font size=2>
adapter_handle.handle,
/* r4 */</font></tt>
<br><tt><font size=2>
6,
/* r5 */</font></tt>
<br><tt><font size=2>@@ -1375,8 +1064,6 @@ u64 hipz_h_alloc_resource_mw(const
struc</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> outparms->rkey
= (u32)rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
mw_handle=%lx rkey=%x",</font></tt>
<br><tt><font size=2>-
ret, outparms->handle.handle, outparms->rkey);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -1384,13 +1071,9 @@ u64 hipz_h_query_mw(const struct
ipz_ada</font></tt>
<br><tt><font size=2>
const struct ehca_mw *mw,</font></tt>
<br><tt><font size=2>
struct ehca_mw_hipzout_parms
*outparms)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2>+ u64 ret;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 pd_out;</font></tt>
<br><tt><font size=2>- u64 rkey_out;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mw=%p mw_handle=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mw, mw->ipz_mw_handle.handle);</font></tt>
<br><tt><font size=2>+ u64 pd_out, rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ret = ehca_hcall_7arg_7ret(H_QUERY_MW,</font></tt>
<br><tt><font size=2>
adapter_handle.handle, /*
r4 */</font></tt>
<br><tt><font size=2>@@ -1405,34 +1088,25 @@ u64 hipz_h_query_mw(const
struct ipz_ada</font></tt>
<br><tt><font size=2>
&dummy);</font></tt>
<br><tt><font size=2> outparms->rkey
= (u32)rkey_out;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx
rkey=%x pd=%lx", ret, outparms->rkey, pd_out);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_free_resource_mw(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>
const struct ehca_mw *mw)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
mw=%p mw_handle=%lx",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, mw, mw->ipz_mw_handle.handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_FREE_RESOURCE,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, /* r4
*/</font></tt>
<br><tt><font size=2>-
mw->ipz_mw_handle.handle, /* r5 */</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_FREE_RESOURCE,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle, /*
r4 */</font></tt>
<br><tt><font size=2>+
mw->ipz_mw_handle.handle, /* r5 */</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> u64 hipz_h_error_data(const struct ipz_adapter_handle
adapter_handle,</font></tt>
<br><tt><font size=2>@@ -1440,34 +1114,24 @@ u64 hipz_h_error_data(const
struct ipz_a</font></tt>
<br><tt><font size=2>
void *rblock,</font></tt>
<br><tt><font size=2>
unsigned long *byte_count)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- u64 ret = H_SUCCESS;</font></tt>
<br><tt><font size=2> u64 dummy;</font></tt>
<br><tt><font size=2>- u64 r_cb;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "adapter_handle=%lx
ressource_handle=%lx rblock=%p",</font></tt>
<br><tt><font size=2>-
adapter_handle.handle, ressource_handle, rblock);</font></tt>
<br><tt><font size=2>+ u64 r_cb = virt_to_abs(rblock);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- if (((u64)rblock)
& 0xfff) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "rblock not page aligned.");</font></tt>
<br><tt><font size=2>+ if (r_cb &
(EHCA_PAGESIZE-1)) {</font></tt>
<br><tt><font size=2>+
ehca_gen_err("rblock not page aligned.");</font></tt>
<br><tt><font size=2>
return H_PARAMETER;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- r_cb = virt_to_abs(rblock);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- ret = ehca_hcall_7arg_7ret(H_ERROR_DATA,</font></tt>
<br><tt><font size=2>-
adapter_handle.handle,</font></tt>
<br><tt><font size=2>-
ressource_handle,</font></tt>
<br><tt><font size=2>-
r_cb,</font></tt>
<br><tt><font size=2>-
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy,</font></tt>
<br><tt><font size=2>-
&dummy);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "ret=%lx",
ret);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return ehca_hcall_7arg_7ret(H_ERROR_DATA,</font></tt>
<br><tt><font size=2>+
adapter_handle.handle,</font></tt>
<br><tt><font size=2>+
ressource_handle,</font></tt>
<br><tt><font size=2>+
r_cb,</font></tt>
<br><tt><font size=2>+
0, 0, 0, 0,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy,</font></tt>
<br><tt><font size=2>+
&dummy);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/hcp_phyp.c
linux-2.6/drivers/infiniband/hw/ehca/hcp_phyp.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/hcp_phyp.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/hcp_phyp.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -39,22 +39,17 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "PHYP"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "ehca_classes.h"</font></tt>
<br><tt><font size=2> #include "hipz_hw.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int hcall_map_page(u64 physaddr, u64 *mapaddr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> *mapaddr
= (u64)(ioremap(physaddr, EHCA_PAGESIZE));</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB(7, "ioremap
physaddr=%lx mapaddr=%lx", physaddr, *mapaddr);</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int hcall_unmap_page(u64 mapaddr)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- EDEB(7, "mapaddr=%lx",
mapaddr);</font></tt>
<br><tt><font size=2> iounmap((volatile
void __iomem*)mapaddr);</font></tt>
<br><tt><font size=2> return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>@@ -68,25 +63,18 @@ int hcp_galpas_ctor(struct h_galpas
*gal</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> galpas->user.fw_handle
= paddr_user;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "paddr_kernel=%lx
paddr_user=%lx galpas->kernel=%lx"</font></tt>
<br><tt><font size=2>-
" galpas->user=%lx",</font></tt>
<br><tt><font size=2>-
paddr_kernel, paddr_user, galpas->kernel.fw_handle,</font></tt>
<br><tt><font size=2>-
galpas->user.fw_handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int hcp_galpas_dtor(struct h_galpas *galpas)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- int ret = 0;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (galpas->kernel.fw_handle)</font></tt>
<br><tt><font size=2>-
ret = hcall_unmap_page(galpas->kernel.fw_handle);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- if (ret)</font></tt>
<br><tt><font size=2>-
return ret;</font></tt>
<br><tt><font size=2>+ if (galpas->kernel.fw_handle)
{</font></tt>
<br><tt><font size=2>+
int ret = hcall_unmap_page(galpas->kernel.fw_handle);</font></tt>
<br><tt><font size=2>+
if (ret)</font></tt>
<br><tt><font size=2>+
return ret;</font></tt>
<br><tt><font size=2>+ }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> galpas->user.fw_handle
= galpas->kernel.fw_handle = 0;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- return ret;</font></tt>
<br><tt><font size=2>+ return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/hcp_phyp.h
linux-2.6/drivers/infiniband/hw/ehca/hcp_phyp.h</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/hcp_phyp.h
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/hcp_phyp.h
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -69,19 +69,13 @@ struct h_galpas {</font></tt>
<br><tt><font size=2> static inline u64 hipz_galpa_load(struct h_galpa
galpa, u32 offset)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> u64 addr
= galpa.fw_handle + offset;</font></tt>
<br><tt><font size=2>- u64 out;</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "addr=%lx
offset=%x ", addr, offset);</font></tt>
<br><tt><font size=2>- out = *(u64 *)
addr;</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "addr=%lx
value=%lx", addr, out);</font></tt>
<br><tt><font size=2>- return out;</font></tt>
<br><tt><font size=2>+ return *(volatile
u64 __force *)addr;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void hipz_galpa_store(struct h_galpa
galpa, u32 offset, u64 value)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> u64 addr
= galpa.fw_handle + offset;</font></tt>
<br><tt><font size=2>- EDEB(7, "addr=%lx
offset=%x value=%lx", addr,</font></tt>
<br><tt><font size=2>-
offset, value);</font></tt>
<br><tt><font size=2>- *(u64 *) addr
= value;</font></tt>
<br><tt><font size=2>+ *(volatile u64
__force *)addr = value;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> int hcp_galpas_ctor(struct h_galpas *galpas,</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/hipz_fns_core.h
linux-2.6/drivers/infiniband/hw/ehca/hipz_fns_core.h</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/hipz_fns_core.h
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/hipz_fns_core.h
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -60,63 +60,41 @@</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void hipz_update_sqa(struct ehca_qp
*qp, u16 nr_wqes)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct h_galpa
gal;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "qp=%p",
qp);</font></tt>
<br><tt><font size=2>- gal = qp->galpas.kernel;</font></tt>
<br><tt><font size=2> /* ringing
doorbell :-) */</font></tt>
<br><tt><font size=2>- hipz_galpa_store_qp(gal,
qpx_sqa, EHCA_BMASK_SET(QPX_SQADDER, nr_wqes));</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "qp=%p
QPx_SQA = %i", qp, nr_wqes);</font></tt>
<br><tt><font size=2>+ hipz_galpa_store_qp(qp->galpas.kernel,
qpx_sqa,</font></tt>
<br><tt><font size=2>+
EHCA_BMASK_SET(QPX_SQADDER,
nr_wqes));</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void hipz_update_rqa(struct ehca_qp
*qp, u16 nr_wqes)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct h_galpa
gal;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "qp=%p",
qp);</font></tt>
<br><tt><font size=2>- gal = qp->galpas.kernel;</font></tt>
<br><tt><font size=2> /* ringing
doorbell :-) */</font></tt>
<br><tt><font size=2>- hipz_galpa_store_qp(gal,
qpx_rqa, EHCA_BMASK_SET(QPX_RQADDER, nr_wqes));</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "qp=%p
QPx_RQA = %i", qp, nr_wqes);</font></tt>
<br><tt><font size=2>+ hipz_galpa_store_qp(qp->galpas.kernel,
qpx_rqa,</font></tt>
<br><tt><font size=2>+
EHCA_BMASK_SET(QPX_RQADDER,
nr_wqes));</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void hipz_update_feca(struct ehca_cq
*cq, u32 nr_cqes)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct h_galpa
gal;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cq=%p",
cq);</font></tt>
<br><tt><font size=2>- gal = cq->galpas.kernel;</font></tt>
<br><tt><font size=2>- hipz_galpa_store_cq(gal,
cqx_feca,</font></tt>
<br><tt><font size=2>+ hipz_galpa_store_cq(cq->galpas.kernel,
cqx_feca,</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(CQX_FECADDER, nr_cqes));</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq=%p
CQx_FECA = %i", cq, nr_cqes);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void hipz_set_cqx_n0(struct ehca_cq
*cq, u32 value)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct h_galpa
gal;</font></tt>
<br><tt><font size=2>- u64 CQx_N0_reg
= 0;</font></tt>
<br><tt><font size=2>+ u64 cqx_n0_reg;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cq=%p
event on solicited completion -- write CQx_N0", cq);</font></tt>
<br><tt><font size=2>- gal = cq->galpas.kernel;</font></tt>
<br><tt><font size=2>- hipz_galpa_store_cq(gal,
cqx_n0,</font></tt>
<br><tt><font size=2>+ hipz_galpa_store_cq(cq->galpas.kernel,
cqx_n0,</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(CQX_N0_GENERATE_SOLICITED_COMP_EVENT,</font></tt>
<br><tt><font size=2>
value));</font></tt>
<br><tt><font size=2>- CQx_N0_reg =
hipz_galpa_load_cq(gal, cqx_n0);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq=%p
loaded CQx_N0=%lx", cq, (unsigned long)CQx_N0_reg);</font></tt>
<br><tt><font size=2>+ cqx_n0_reg =
hipz_galpa_load_cq(cq->galpas.kernel, cqx_n0);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> static inline void hipz_set_cqx_n1(struct ehca_cq
*cq, u32 value)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct h_galpa
gal;</font></tt>
<br><tt><font size=2>- u64 CQx_N1_reg
= 0;</font></tt>
<br><tt><font size=2>+ u64 cqx_n1_reg;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "cq=%p
event on completion -- write CQx_N1",</font></tt>
<br><tt><font size=2>-
cq);</font></tt>
<br><tt><font size=2>- gal = cq->galpas.kernel;</font></tt>
<br><tt><font size=2>- hipz_galpa_store_cq(gal,
cqx_n1,</font></tt>
<br><tt><font size=2>+ hipz_galpa_store_cq(cq->galpas.kernel,
cqx_n1,</font></tt>
<br><tt><font size=2>
EHCA_BMASK_SET(CQX_N1_GENERATE_COMP_EVENT, value));</font></tt>
<br><tt><font size=2>- CQx_N1_reg =
hipz_galpa_load_cq(gal, cqx_n1);</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "cq=%p
loaded CQx_N1=%lx", cq, (unsigned long)CQx_N1_reg);</font></tt>
<br><tt><font size=2>+ cqx_n1_reg =
hipz_galpa_load_cq(cq->galpas.kernel, cqx_n1);</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> #endif /* __HIPZ_FNC_CORE_H__ */</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ipz_pt_fn.c
linux-2.6/drivers/infiniband/hw/ehca/ipz_pt_fn.c</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ipz_pt_fn.c
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ipz_pt_fn.c
2006-08-30 20:00:16.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -38,13 +38,9 @@</font></tt>
<br><tt><font size=2> * POSSIBILITY OF SUCH DAMAGE.</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#define DEB_PREFIX "iptz"</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> #include "ehca_tools.h"</font></tt>
<br><tt><font size=2> #include "ipz_pt_fn.h"</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-extern int ehca_hwlevel;</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> void *ipz_qpageit_get_inc(struct ipz_queue *queue)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> void *ret
= ipz_qeit_get(queue);</font></tt>
<br><tt><font size=2>@@ -54,10 +50,9 @@ void *ipz_qpageit_get_inc(struct
ipz_que</font></tt>
<br><tt><font size=2>
ret = NULL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (((u64)ret)
% EHCA_PAGESIZE) {</font></tt>
<br><tt><font size=2>-
EDEB(4, "ERROR!! not at PAGE-Boundary");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("ERROR!! not at PAGE-Boundary");</font></tt>
<br><tt><font size=2>
return NULL;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- EDEB(7, "queue=%p
ret=%p", queue, ret);</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -65,15 +60,13 @@ void *ipz_qeit_eq_get_inc(struct
ipz_que</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> void *ret
= ipz_qeit_get(queue);</font></tt>
<br><tt><font size=2> u64 last_entry_in_q
= queue->queue_length - queue->qe_size;</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> queue->current_q_offset
+= queue->qe_size;</font></tt>
<br><tt><font size=2> if (queue->current_q_offset
> last_entry_in_q) {</font></tt>
<br><tt><font size=2>
queue->current_q_offset = 0;</font></tt>
<br><tt><font size=2>
queue->toggle_state = (~queue->toggle_state)
& 1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "queue=%p
ret=%p new current_q_offset=%lx qe_size=%x",</font></tt>
<br><tt><font size=2>-
queue, ret, queue->current_q_offset, queue->qe_size);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -84,22 +77,20 @@ int ipz_queue_ctor(struct ipz_queue
*que</font></tt>
<br><tt><font size=2> int pages_per_kpage
= PAGE_SIZE >> EHCA_PAGESHIFT;</font></tt>
<br><tt><font size=2> int f;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "nr_of_pages=%x
pagesize=%x qe_size=%x pages_per_kpage=%x",</font></tt>
<br><tt><font size=2>-
nr_of_pages, pagesize, qe_size, pages_per_kpage);</font></tt>
<br><tt><font size=2> if (pagesize
> PAGE_SIZE) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "FATAL ERROR: pagesize=%x is greater
than "</font></tt>
<br><tt><font size=2>-
"kernel
page size", pagesize);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("FATAL ERROR: pagesize=%x is greater
"</font></tt>
<br><tt><font size=2>+
"than kernel page size", pagesize);</font></tt>
<br><tt><font size=2>
return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> if (!pages_per_kpage)
{</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "FATAL ERROR: invalid kernel page
size. "</font></tt>
<br><tt><font size=2>-
"pages_per_kpage=%x",
pages_per_kpage);</font></tt>
<br><tt><font size=2>+
ehca_gen_err("FATAL ERROR: invalid kernel page
size. "</font></tt>
<br><tt><font size=2>+
"pages_per_kpage=%x", pages_per_kpage);</font></tt>
<br><tt><font size=2>
return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> queue->queue_length
= nr_of_pages * pagesize;</font></tt>
<br><tt><font size=2> queue->queue_pages
= vmalloc(nr_of_pages * sizeof(void *));</font></tt>
<br><tt><font size=2> if (!queue->queue_pages)
{</font></tt>
<br><tt><font size=2>-
EDEB(4, "ERROR!! didn't get the memory");</font></tt>
<br><tt><font size=2>+
ehca_gen_err("ERROR!! didn't get the memory");</font></tt>
<br><tt><font size=2>
return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> memset(queue->queue_pages,
0, nr_of_pages * sizeof(void *));</font></tt>
<br><tt><font size=2>@@ -126,14 +117,11 @@ int ipz_queue_ctor(struct ipz_queue
*que</font></tt>
<br><tt><font size=2> queue->act_nr_of_sg
= nr_of_sg;</font></tt>
<br><tt><font size=2> queue->pagesize
= pagesize;</font></tt>
<br><tt><font size=2> queue->toggle_state
= 1;</font></tt>
<br><tt><font size=2>- EDEB_EX(7, "queue_length=%x
queue_pages=%p qe_size=%x"</font></tt>
<br><tt><font size=2>-
" act_nr_of_sg=%x", queue->queue_length,
queue->queue_pages,</font></tt>
<br><tt><font size=2>-
queue->qe_size, queue->act_nr_of_sg);</font></tt>
<br><tt><font size=2> return 1;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> ipz_queue_ctor_exit0:</font></tt>
<br><tt><font size=2>- EDEB_ERR(4, "Couldn't
get alloc pages queue=%p f=%x nr_of_pages=%x",</font></tt>
<br><tt><font size=2>-
queue, f, nr_of_pages);</font></tt>
<br><tt><font size=2>+ ehca_gen_err("Couldn't
get alloc pages queue=%p f=%x nr_of_pages=%x",</font></tt>
<br><tt><font size=2>+
queue, f, nr_of_pages);</font></tt>
<br><tt><font size=2> for (f =
0; f < nr_of_pages; f += pages_per_kpage) {</font></tt>
<br><tt><font size=2>
if (!(queue->queue_pages)[f])</font></tt>
<br><tt><font size=2>
break;</font></tt>
<br><tt><font size=2>@@ -148,19 +136,14 @@ int ipz_queue_dtor(struct ipz_queue
*que</font></tt>
<br><tt><font size=2> int g;</font></tt>
<br><tt><font size=2> int nr_pages;</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EN(7, "ipz_queue
pointer=%p", queue);</font></tt>
<br><tt><font size=2> if (!queue
|| !queue->queue_pages) {</font></tt>
<br><tt><font size=2>-
EDEB_ERR(4, "queue or queue_pages is NULL");</font></tt>
<br><tt><font size=2>+
ehca_gen_dbg("queue or queue_pages is NULL");</font></tt>
<br><tt><font size=2>
return 0;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>- EDEB(7, "destructing
a queue with the following "</font></tt>
<br><tt><font size=2>-
"properties:\n nr_of_pages=%x pagesize=%x qe_size=%x",</font></tt>
<br><tt><font size=2>-
queue->act_nr_of_sg, queue->pagesize, queue->qe_size);</font></tt>
<br><tt><font size=2> nr_pages
= queue->queue_length / queue->pagesize;</font></tt>
<br><tt><font size=2> for (g =
0; g < nr_pages; g += pages_per_kpage)</font></tt>
<br><tt><font size=2>
free_page((unsigned long)(queue->queue_pages)[g]);</font></tt>
<br><tt><font size=2> vfree(queue->queue_pages);</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB_EX(7, "queue
freed!");</font></tt>
<br><tt><font size=2> return 1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2>diff -Nurp linux-2.6_orig/drivers/infiniband/hw/ehca/ipz_pt_fn.h
linux-2.6/drivers/infiniband/hw/ehca/ipz_pt_fn.h</font></tt>
<br><tt><font size=2>--- linux-2.6_orig/drivers/infiniband/hw/ehca/ipz_pt_fn.h
2006-09-08 00:16:13.000000000 +0200</font></tt>
<br><tt><font size=2>+++ linux-2.6/drivers/infiniband/hw/ehca/ipz_pt_fn.h
2006-08-30 20:00:17.000000000 +0200</font></tt>
<br><tt><font size=2>@@ -43,7 +43,6 @@</font></tt>
<br><tt><font size=2> #ifndef __IPZ_PT_FN_H__</font></tt>
<br><tt><font size=2> #define __IPZ_PT_FN_H__</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>-#include "ehca_qes.h"</font></tt>
<br><tt><font size=2> #define EHCA_PAGESHIFT 12</font></tt>
<br><tt><font size=2> #define EHCA_PAGESIZE 4096UL</font></tt>
<br><tt><font size=2> #define EHCA_PAGEMASK (~(EHCA_PAGESIZE-1))</font></tt>
<br><tt><font size=2>@@ -76,7 +75,7 @@ struct ipz_queue {</font></tt>
<br><tt><font size=2> */</font></tt>
<br><tt><font size=2> static inline void *ipz_qeit_calc(struct ipz_queue
*queue, u64 q_offset)</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2>- struct ipz_page
*current_page = NULL;</font></tt>
<br><tt><font size=2>+ struct ipz_page
*current_page;</font></tt>
<br><tt><font size=2> if (q_offset
>= queue->queue_length)</font></tt>
<br><tt><font size=2>
return NULL;</font></tt>
<br><tt><font size=2> current_page
= (queue->queue_pages)[q_offset >> EHCA_PAGESHIFT];</font></tt>
<br><tt><font size=2>@@ -118,9 +117,6 @@ static inline void *ipz_qeit_get_inc(str</font></tt>
<br><tt><font size=2>
queue->toggle_state = (~queue->toggle_state)
& 1;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>- EDEB(7, "queue=%p
ret=%p new current_q_addr=%lx qe_size=%x",</font></tt>
<br><tt><font size=2>-
queue, ret, queue->current_q_offset, queue->qe_size);</font></tt>
<br><tt><font size=2>-</font></tt>
<br><tt><font size=2> return ret;</font></tt>
<br><tt><font size=2> }</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2>@@ -230,7 +226,6 @@ static inline void *ipz_eqit_eq_get_inc_</font></tt>
<br><tt><font size=2> {</font></tt>
<br><tt><font size=2> void *ret
= ipz_qeit_get(queue);</font></tt>
<br><tt><font size=2> u32 qe =
*(u8 *) ret;</font></tt>
<br><tt><font size=2>- EDEB(7, "ipz_QEit_EQ_get_inc_valid
qe=%x", qe);</font></tt>
<br><tt><font size=2> if ((qe
>> 7) == (queue->toggle_state & 1))</font></tt>
<br><tt><font size=2>
ipz_qeit_eq_get_inc(queue); /* this is a good
one */</font></tt>
<br><tt><font size=2> else</font></tt>