From patchwork Thu Apr 13 14:48:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 9679499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B00E160381 for ; Thu, 13 Apr 2017 14:48:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A10FE2866E for ; Thu, 13 Apr 2017 14:48:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95B552867A; Thu, 13 Apr 2017 14:48:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C67C52866E for ; Thu, 13 Apr 2017 14:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753592AbdDMOsF (ORCPT ); Thu, 13 Apr 2017 10:48:05 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34044 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752465AbdDMOsF (ORCPT ); Thu, 13 Apr 2017 10:48:05 -0400 Received: by mail-wr0-f196.google.com with SMTP id u18so8951657wrc.1 for ; Thu, 13 Apr 2017 07:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=1Q7eppZJX4ivEwV28n03KdQM5yIzO1aWsNrZjNEYDMw=; b=xAj6yaU3lopwmqaTAlIiJfXW6iCpuiLF2mYg1ofCq2IfkAxkraI8gVhO2XKXziVUNk TJE5vlczFO2yHUd5uEFjZWuIs9PWtqBgUveHKKtOWEX6Iu3tQrDQrYPD1+UBUFSJl42m a81zKMgQHLeqUXxT6uwGiUdqFEvd31GZvYqI+rTFSEu+vy7+OTP04/wIq4NgkCtwiBSO 6a8F074Pf4PDh6A7eDorbEXGcyrVZCzJ3KJK91Or8ITAOs7p8hI5WSSF7XiEf5ZpkW8c 0j9mxauRoguk9qnNCL4eIViBsCXFoxj+tTSASrJPHfAPR1wqIaBCMJVqCGRdw4Kn0q/p pNwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=1Q7eppZJX4ivEwV28n03KdQM5yIzO1aWsNrZjNEYDMw=; b=O471BEuksTQlZ8av2rLVvqBXEOD6MHTcAsdbWPT40JDM8WizkbHfvb4A0QP3eoag8j mhybnfVK0Q/zd9qIOrelIHMj9zHG2oGwcH1I+OjLRHbVKhLXgok6L64LdgrO4tezyzjO 36J4NaHISdNJAoevkJdEOfHUHAHreJdzo+hZ+//tgwwXSDU2W9qzTtiIurrPhSrgqXXZ ekDUkLeXQFOZ1XC3ka+N7I0iVfBzp2IBULOUkLwq2RBXFrgr4LPElY9BG+6LTB3V3gvh OIrMnNdwrtBLqz8J0JwBgFwSmNrz0lyRgYFryLEETcVUYm8v+xG2TvEwZ6ivp6Ij7if+ k7DA== X-Gm-Message-State: AN3rC/7BN6/tyE4j/7BCw8Cp72MXX0yhzcP+LC3XXH81M0mB1B84eOZE lhINto7DqGNXKg== X-Received: by 10.223.142.143 with SMTP id q15mr3277883wrb.180.1492094883717; Thu, 13 Apr 2017 07:48:03 -0700 (PDT) Received: from [192.168.1.183] (c-67-189-170-197.hsd1.ma.comcast.net. [67.189.170.197]) by smtp.googlemail.com with ESMTPSA id l41sm29874214wrl.59.2017.04.13.07.48.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 07:48:02 -0700 (PDT) To: Doug Ledford Cc: Honggang LI , Bart Van Assche , "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH rdma-core 1/3] srp_daemon/srp_daemon.c: Don't rely on attribute offset, in get_shared_pkeys Message-ID: Date: Thu, 13 Apr 2017 10:48:00 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP get_shared_pkeys has been using SubAdmGet rather than SubAdmGetTable since commit 2ad09524931dbf98d412e1912c1bdbf22f8ac81d srp_daemon: Work around SM bug over non-default P_Key support so RMPP is no longer used in response so it's not safe to rely on AttributeOffset field. Good MAD status is sufficient to say that valid PathRecord was returned. Found-by: Honggang LI using embedded subnet manager running on an Intel True Scale Edge Switch 12300. This has been broken since srptools-1.0.1 which was first release containing commit mentioned above. Signed-off-by: Hal Rosenstock Reviewed-by: Bart Van Assche -- Reviewed-by: Honggang Li --- srp_daemon/srp_daemon.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index 71b5f07..9fb2ecc 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -1102,7 +1102,6 @@ static int get_shared_pkeys(struct resources *res, struct umad_sa_packet *out_sa_mad, *in_sa_mad; struct ib_path_rec *path_rec; ssize_t len; - int size; int i, num_pkeys = 0; uint16_t pkey; uint16_t local_port_lid = get_port_lid(res->ud_res->ib_ctx, @@ -1148,14 +1147,6 @@ static int get_shared_pkeys(struct resources *res, if (len < 0) goto err; - size = ib_get_attr_size(in_sa_mad->attr_offset); - if (!size) { - if (config->verbose) - printf("PathRec Query did not find any targets " - "over P_Key %x\n", pkey); - continue; - } - path_rec = (struct ib_path_rec *)in_sa_mad->data; pkeys[num_pkeys++] = be16toh(path_rec->pkey); }