From patchwork Thu Feb 21 17:06:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2172211 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 486C1DF215 for ; Thu, 21 Feb 2013 17:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754500Ab3BURHD (ORCPT ); Thu, 21 Feb 2013 12:07:03 -0500 Received: from mail-bk0-f44.google.com ([209.85.214.44]:55427 "EHLO mail-bk0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754375Ab3BURHC (ORCPT ); Thu, 21 Feb 2013 12:07:02 -0500 Received: by mail-bk0-f44.google.com with SMTP id j4so4213107bkw.3 for ; Thu, 21 Feb 2013 09:07:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=B3+tYRhiMZ4QwCgOJrjGf2mdAwxCXXeFD34tjM3DQaU=; b=pVKDj7w6gKxfAGf8yROV/Z5QPfpqMOcymSAyUOOp0qVMgqhVWrC0d4JPIvPhZuM52B envmefkJfZoUqD2nSIdlkhLr0F3Q8pf+rA4fTLq5IFybex7gJaTqLroxXkDSaIUTXiz7 87ROrC8qlVrKAqVdiwVwmkiOQ+OdFsJ8DWFJycsmu891yrVL2/hB84O0a91S+n9ZyGzj a8jGS4d1Nq7IyquIZK2I/DaFDWw7LjmTX63yPQhQSoCR4RKmfxhjpPdan7JuViJ7cjw2 N2nUbUXUZ1hStFimGAdQ+launXW8Pg9KsaVIC84gzWL8M4nFsyMg/vPDXxrMszEejlRC EHJQ== X-Received: by 10.204.147.25 with SMTP id j25mr10657568bkv.128.1361466420270; Thu, 21 Feb 2013 09:07:00 -0800 (PST) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id k4sm24722035bkv.18.2013.02.21.09.06.59 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 09:06:59 -0800 (PST) Message-ID: <51265432.10800@dev.mellanox.co.il> Date: Thu, 21 Feb 2013 12:06:58 -0500 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH] osmtest/osmt_multicast.c: Fix IPoIB MC group recognition X-Gm-Message-State: ALoCoQkIvO/Kyue/LnrrPH0PokiDQmWEjj3jYHfmEBeLfjNkkPj/yHa+4pajLi9zo0D1kgxip9WB Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Recognize IPoIB groups by signature in MGID Signed-off-by: Hal Rosenstock --- osmtest/osmt_multicast.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/osmtest/osmt_multicast.c b/osmtest/osmt_multicast.c index d24f03a..ac8d1b2 100644 --- a/osmtest/osmt_multicast.c +++ b/osmtest/osmt_multicast.c @@ -435,10 +435,23 @@ void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt, * - Try GetTable with PortGUID wildcarded and get back some groups. ***********************************************************************/ +#define PREFIX_MASK CL_HTON64(0xff10ffff00000000ULL) +#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL) +#define IPV4_PREFIX_MASK CL_HTON64(0xff10ffff00000000ULL) +#define PREFIX_SIGNATURE_IPV4 CL_HTON64(0xff10401b00000000ULL) + +static unsigned is_ipv4_mgid(ib_gid_t * mgid) +{ + return ((mgid->unicast.prefix & IPV4_PREFIX_MASK) == PREFIX_SIGNATURE_IPV4); +} + +static unsigned is_ipv6_mgid(ib_gid_t * mgid) +{ + return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE); +} + /* The following macro can be used only within the osmt_run_mcast_flow() function */ -#define IS_IPOIB_MGID(p_mgid) \ - ( !memcmp(&osm_ipoib_good_mgid, (p_mgid), sizeof(osm_ipoib_good_mgid)) || \ - !memcmp(&osm_ts_ipoib_good_mgid, (p_mgid), sizeof(osm_ts_ipoib_good_mgid)) ) +#define IS_IPOIB_MGID(p_mgid) (is_ipv4_mgid(p_mgid) || is_ipv6_mgid(p_mgid)) ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt) { @@ -486,6 +499,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt) 0xff, 0xff, 0xff, 0xee, /* 32 bit IPv4 broadcast address */ }, }; +#if 0 static ib_gid_t osm_ts_ipoib_good_mgid = { { 0xff, /* multicast field */ @@ -496,6 +510,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt) 0x00, 0x00, 0x00, 0x01, /* 32 bit IPv4 broadcast address */ }, }; +#endif static ib_gid_t osm_ipoib_good_mgid = { { 0xff, /* multicast field */