<br><br>
<div><span class="gmail_quote">On 8/26/09, <b class="gmail_sendername">Joachim Fenkes</b> <<a href="mailto:fenkes@de.ibm.com">fenkes@de.ibm.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">The old code used a lot of hardcoded values, which might not be valid in all<br>environments (especially routed fabrics or partitioned subnets). Copy as<br>
much information as possible from the incoming request to prevent that.<br><br>Signed-off-by: Joachim Fenkes <<a href="mailto:fenkes@de.ibm.com">fenkes@de.ibm.com</a>><br>---<br><br>Hal, Jason -- here's the change I promised. Looks okay to you?<br>
Roland -- if Hal and Jason don't object, please queue this up for the next<br>kernel. Thanks!</blockquote>
<div> </div>
<div>Thanks for doing this. It looks sane to me. The only issue I recall that appears to be remaining is a better setting of ClassPortInfo:RespTimeValue rather than hardcoding. Perhaps using the value from PortInfo is the way to go (ideally it would be that value from the port to which the the requester is being redirected to but that might not be so easy to get from this port (I guess that could be SA Get PortInfoRecord for that port but that is a larger change and it likely to be same as local port issuing the redirect response).</div>
<div> </div>
<div>-- Hal</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Regards,<br>Joachim<br><br>drivers/infiniband/hw/ehca/ehca_sqp.c | 47 ++++++++++++++++++++++++++++----<br>
1 files changed, 41 insertions(+), 6 deletions(-)<br><br>diff --git a/drivers/infiniband/hw/ehca/ehca_sqp.c b/drivers/infiniband/hw/ehca/ehca_sqp.c<br>index c568b28..8c1213f 100644<br>--- a/drivers/infiniband/hw/ehca/ehca_sqp.c<br>
+++ b/drivers/infiniband/hw/ehca/ehca_sqp.c<br>@@ -125,14 +125,30 @@ struct ib_perf {<br> u8 data[192];<br>} __attribute__ ((packed));<br><br>+/* TC/SL/FL packed into 32 bits, as in ClassPortInfo */<br>+struct tcslfl {<br>
+ u32 tc:8;<br>+ u32 sl:4;<br>+ u32 fl:20;<br>+} __attribute__ ((packed));<br>+<br>+/* IP Version/TC/FL packed into 32 bits, as in GRH */<br>+struct vertcfl {<br>+ u32 ver:4;<br>+ u32 tc:8;<br>
+ u32 fl:20;<br>+} __attribute__ ((packed));<br><br>static int ehca_process_perf(struct ib_device *ibdev, u8 port_num,<br>+ struct ib_wc *in_wc, struct ib_grh *in_grh,<br> struct ib_mad *in_mad, struct ib_mad *out_mad)<br>
{<br> struct ib_perf *in_perf = (struct ib_perf *)in_mad;<br> struct ib_perf *out_perf = (struct ib_perf *)out_mad;<br> struct ib_class_port_info *poi =<br> (struct ib_class_port_info *)out_perf->data;<br>
+ struct tcslfl *tcslfl =<br>+ (struct tcslfl *)&poi->redirect_tcslfl;<br> struct ehca_shca *shca =<br> container_of(ibdev, struct ehca_shca, ib_device);<br> struct ehca_sport *sport = &shca->sport[port_num - 1];<br>
@@ -158,10 +174,29 @@ static int ehca_process_perf(struct ib_device *ibdev, u8 port_num,<br> poi->base_version = 1;<br> poi->class_version = 1;<br> poi->resp_time_value = 18;<br>
- poi->redirect_lid = sport->saved_attr.lid;<br>- poi->redirect_qp = sport->pma_qp_nr;<br>+<br>+ /* copy local routing information from WC where applicable */<br>+ tcslfl->sl = in_wc->sl;<br>
+ poi->redirect_lid =<br>+ sport->saved_attr.lid | in_wc->dlid_path_bits;<br>+ poi->redirect_qp = sport->pma_qp_nr;<br> poi->redirect_qkey = IB_QP1_QKEY;<br>
- poi->redirect_pkey = IB_DEFAULT_PKEY_FULL;<br>+<br>+ ehca_query_pkey(ibdev, port_num, in_wc->pkey_index,<br>+ &poi->redirect_pkey);<br>+<br>+ /* if request was globally routed, copy route info */<br>
+ if (in_grh) {<br>+ struct vertcfl *vertcfl =<br>+ (struct vertcfl *)&in_grh->version_tclass_flow;<br>+ memcpy(poi->redirect_gid, in_grh->dgid.raw,<br>
+ sizeof(poi->redirect_gid));<br>+ tcslfl->tc = vertcfl->tc;<br>+ tcslfl->fl = vertcfl->fl;<br>+ } else<br>
+ /* else only fill in default GID */<br>+ ehca_query_gid(ibdev, port_num, 0,<br>+ (union ib_gid *)&poi->redirect_gid);<br><br> ehca_dbg(ibdev, "ehca_pma_lid=%x ehca_pma_qp=%x",<br>
sport->saved_attr.lid, sport->pma_qp_nr);<br>@@ -183,8 +218,7 @@ perf_reply:<br><br>int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,<br> struct ib_wc *in_wc, struct ib_grh *in_grh,<br>
- struct ib_mad *in_mad,<br>- struct ib_mad *out_mad)<br>+ struct ib_mad *in_mad, struct ib_mad *out_mad)<br>{<br> int ret;<br><br>@@ -196,7 +230,8 @@ int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,<br>
return IB_MAD_RESULT_SUCCESS;<br><br> ehca_dbg(ibdev, "port_num=%x src_qp=%x", port_num, in_wc->src_qp);<br>- ret = ehca_process_perf(ibdev, port_num, in_mad, out_mad);<br>+ ret = ehca_process_perf(ibdev, port_num, in_wc, in_grh,<br>
+ in_mad, out_mad);<br><br> return ret;<br>}<br>--<br>1.6.0.4<br><br><br>_______________________________________________<br>ewg mailing list<br><a href="mailto:ewg@lists.openfabrics.org">ewg@lists.openfabrics.org</a><br>
<a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg">http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg</a><br></blockquote></div><br>