From patchwork Mon Aug 2 18:30:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arlin Davis X-Patchwork-Id: 116573 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o72IUjC8015544 for ; Mon, 2 Aug 2010 18:30:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753839Ab0HBSap (ORCPT ); Mon, 2 Aug 2010 14:30:45 -0400 Received: from mga02.intel.com ([134.134.136.20]:57769 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753685Ab0HBSao convert rfc822-to-8bit (ORCPT ); Mon, 2 Aug 2010 14:30:44 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 02 Aug 2010 11:28:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.55,304,1278313200"; d="scan'208";a="541226535" Received: from orsmsx603.amr.corp.intel.com ([10.22.226.49]) by orsmga002.jf.intel.com with ESMTP; 02 Aug 2010 11:31:00 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.226.213) by orsmsx603.amr.corp.intel.com (10.22.226.49) with Microsoft SMTP Server (TLS) id 8.2.254.0; Mon, 2 Aug 2010 11:30:43 -0700 Received: from orsmsx506.amr.corp.intel.com ([10.22.226.44]) by orsmsx601.amr.corp.intel.com ([10.22.226.213]) with mapi; Mon, 2 Aug 2010 11:30:43 -0700 From: "Davis, Arlin R" To: linux-rdma , "ofw@lists.openfabrics.org" Date: Mon, 2 Aug 2010 11:30:42 -0700 Subject: [PATCH] dapl-2.0 - scm, ucm: improperly handles pkey check/query in host order Thread-Topic: [PATCH] dapl-2.0 - scm, ucm: improperly handles pkey check/query in host order Thread-Index: AcsNeGIZrKpDLe9TRUW5U9YZUm3b7gk9zv/g Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 02 Aug 2010 18:30:46 +0000 (UTC) diff --git a/dapl/openib_common/util.c b/dapl/openib_common/util.c index a69261f..5076df8 100644 --- a/dapl/openib_common/util.c +++ b/dapl/openib_common/util.c @@ -326,7 +326,7 @@ DAT_RETURN dapls_ib_query_hca(IN DAPL_HCA * hca_ptr, /* set SL, PKEY values, defaults = 0 */ hca_ptr->ib_trans.pkey_idx = 0; - hca_ptr->ib_trans.pkey = dapl_os_get_env_val("DAPL_IB_PKEY", 0); + hca_ptr->ib_trans.pkey = htons(dapl_os_get_env_val("DAPL_IB_PKEY", 0)); hca_ptr->ib_trans.sl = dapl_os_get_env_val("DAPL_IB_SL", 0); /* index provided, get pkey; pkey provided, get index */ @@ -345,10 +345,10 @@ DAT_RETURN dapls_ib_query_hca(IN DAPL_HCA * hca_ptr, } } if (i == dev_attr.max_pkeys) { - dapl_log(DAPL_DBG_TYPE_WARN, - " Warning: new pkey(%d), query (%s)" - " err or key !found, using defaults\n", - hca_ptr->ib_trans.pkey, strerror(errno)); + dapl_log(DAPL_DBG_TYPE_ERR, + " ERR: new pkey(0x%x), query (%s)" + " err or key !found, using default pkey_idx=0\n", + ntohs(hca_ptr->ib_trans.pkey), strerror(errno)); } } skip_ib: @@ -365,13 +365,13 @@ skip_ib: #endif dapl_log(DAPL_DBG_TYPE_UTIL, " query_hca: (%x.%x) eps %d, sz %d evds %d," - " sz %d mtu %d - pkey %d p_idx %d sl %d\n", + " sz %d mtu %d - pkey %x p_idx %d sl %d\n", ia_attr->hardware_version_major, ia_attr->hardware_version_minor, ia_attr->max_eps, ia_attr->max_dto_per_ep, ia_attr->max_evds, ia_attr->max_evd_qlen, 128 << hca_ptr->ib_trans.mtu, - hca_ptr->ib_trans.pkey, + ntohs(hca_ptr->ib_trans.pkey), hca_ptr->ib_trans.pkey_idx, hca_ptr->ib_trans.sl);