From patchwork Wed May 29 17:09:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Hefty X-Patchwork-Id: 247344 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1E35F2C0351 for ; Thu, 30 May 2013 03:11:46 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965180Ab3E2RLW (ORCPT ); Wed, 29 May 2013 13:11:22 -0400 Received: from mga09.intel.com ([134.134.136.24]:6764 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759657Ab3E2RJ5 (ORCPT ); Wed, 29 May 2013 13:09:57 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 29 May 2013 10:07:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,765,1363158000"; d="scan'208";a="321424688" Received: from cst-linux.jf.intel.com ([10.23.221.72]) by orsmga001.jf.intel.com with ESMTP; 29 May 2013 10:09:40 -0700 From: sean.hefty@intel.com To: roland@purestorage.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org Cc: Sean Hefty Subject: [PATCH v5 20/28] ib/sa: Export function to pack a path record into wire format Date: Wed, 29 May 2013 10:09:26 -0700 Message-Id: <1369847374-12176-21-git-send-email-sean.hefty@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1369847374-12176-1-git-send-email-sean.hefty@intel.com> References: <1369847374-12176-1-git-send-email-sean.hefty@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Sean Hefty Allow converting from struct ib_sa_path_rec to the IB defined SA path record wire format. This will be used to report path data from the rdma cm into user space. Signed-off-by: Sean Hefty --- drivers/infiniband/core/sa_query.c | 6 ++++++ include/rdma/ib_sa.h | 7 +++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 934f45e..9838ca4 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -652,6 +652,12 @@ void ib_sa_unpack_path(void *attribute, struct ib_sa_path_rec *rec) } EXPORT_SYMBOL(ib_sa_unpack_path); +void ib_sa_pack_path(struct ib_sa_path_rec *rec, void *attribute) +{ + ib_pack(path_rec_table, ARRAY_SIZE(path_rec_table), rec, attribute); +} +EXPORT_SYMBOL(ib_sa_pack_path); + static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query, int status, struct ib_sa_mad *mad) diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index 8275e53..125f871 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h @@ -402,6 +402,12 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, struct ib_ah_attr *ah_attr); /** + * ib_sa_pack_path - Conert a path record from struct ib_sa_path_rec + * to IB MAD wire format. + */ +void ib_sa_pack_path(struct ib_sa_path_rec *rec, void *attribute); + +/** * ib_sa_unpack_path - Convert a path record from MAD format to struct * ib_sa_path_rec. */ @@ -418,4 +424,5 @@ int ib_sa_guid_info_rec_query(struct ib_sa_client *client, void *context), void *context, struct ib_sa_query **sa_query); + #endif /* IB_SA_H */