Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3532980imm; Tue, 29 May 2018 08:50:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoSYomn5YEEMv3bOsRFv9FhgWwgxLQBT45po1uU0gGordWaHG6iWIIWU4jYs6oTOZEVJ+Mw X-Received: by 2002:a62:9e88:: with SMTP id f8-v6mr17408920pfk.206.1527609008097; Tue, 29 May 2018 08:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527609008; cv=none; d=google.com; s=arc-20160816; b=JNBkoSWEjGO3dG+1IWvTHX0oG8uswwWCHiQ4la1rEaL5HibK38hoFdBYke4sT7zgsx xKszHbcpStzjC7GJ3G5SyIsTa1NI8Hy1htrSZc9fi3I0WimVwgJhgOeFtn+yHKorrXGf K375w5DtlLtothg83qE5zdBF+S24GxXW1/OGgu2rRBrCINn8zV/8bt/ZlcBwOOR/0OSp BgYdcgrVHO4srYfsnuLRahQoCp9YX+RgXj2LzTbLGghx0N8v1Ep1DjEOoY0oHGeflRP1 aiTSks5Zu86qWq7Q/ZxOZZkbUj3islqVQXMMeP8lfX+VR9YLsM8bNet768taby1b/8iA CpMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=UPEz4Fl2K4iZyhgsa18pZy1SjuPiUdjxZ2osatxfeUo=; b=uZMc5MnB+SF+XvL9eQ2PJayWQLEaBy74k9JDfynNHXeuKfKCemESKNW4am52IQt10h RlN0SqOhrnYUhNlBNIwtapRLwrWsD7Ws1xfnftrKu7ylOtQgKupjcsjUaKTyhqVLhsoK hGyiShq5eDrTBVWjL2R8dRb+TtlP2lHO2MH0bXbXDaSQSptdhPvju8l+wFa8x7JukhBl QDZdXUapGECsYcV/NcW73eshj+N3Eaut8OCSnYgb8ey9nvtphReASV/aY7fqyatG5eCO MZ3r+/DH4MIF3CFiPBPZ4IxTUU39SMNUjamvlNOek3lkzes2qYVyzyX8CJ7iWyHzzIM0 DOZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=IVvRgPWm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17-v6si12909261pls.597.2018.05.29.08.49.54; Tue, 29 May 2018 08:50:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=IVvRgPWm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964923AbeE2Ptc (ORCPT + 99 others); Tue, 29 May 2018 11:49:32 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38081 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964830AbeE2Pt3 (ORCPT ); Tue, 29 May 2018 11:49:29 -0400 Received: by mail-wm0-f67.google.com with SMTP id m129-v6so41881482wmb.3 for ; Tue, 29 May 2018 08:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UPEz4Fl2K4iZyhgsa18pZy1SjuPiUdjxZ2osatxfeUo=; b=IVvRgPWm/51Nr/D85/Ay2gDMy5oXzmXfoS4Nd/23VcvzkLJzDP/KiVOAC1BnovogGW mFINV3S1cQNHxAWLz7TLioiYQUfFLg6Sr+OGbL5mBllrcYmIaD7C+RpnLd9HL+DQOmxf 2zAD2C1v+lGQmzeCBkfPIEkAf1DoOovqP1zojcwpTNhvZo2ZL6Ihu3jsig7jpYYSw0xu FxYOmHBCplDKmtGozb07MiI9XUOEK1uHP8s0pe9HdAnr+71hrB7eqhrvqZGq/iTWm+PU di/VSNIJXC1BQ8X6Nc4guo1I0EUBAa7whliUY7AO/h2W1seh7LYp3Y0OJvRWJeTBVTP+ /wZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UPEz4Fl2K4iZyhgsa18pZy1SjuPiUdjxZ2osatxfeUo=; b=UtVzNonU6OyfqbleZYIvsAPMbd4QPAdbuyz1cwPcRkYG+tLQ2CWPSaHh+IEx2kWXnh h48AUSaBsPtnOmZvHXf0fXJ8c8veWbbCXIMgNzam5egqhioVl+/5z2KGmIwRvzdBU80B CWR6/hWh7X4+nwKFSGN96OSJLUP+4kpsAgpkPfyh+6d9NR/lmsQ6bvhwXgLd1X8F6rRx Lcqayt+e8/7D9nE5dL+ZzDQOrAHiCP9Ypk50k/74dGLUkh+1yAd07Jr46JHsOxovGkc7 S/knYrINrdspE2uooG129zsVITAzP2IvNNBUdKaIMHw1Y2B9MUr6Zrc4jsdzjxv4apQB 9ANA== X-Gm-Message-State: ALKqPwcDKA+jwUFD8yB9Cuid4AuR7PhCDSyEmTUDHxO0bixbErfEUe2J yi6N5XHeHe3yIWsVqFKBqm+xOg== X-Received: by 2002:a1c:3c3:: with SMTP id 186-v6mr13849431wmd.140.1527608967961; Tue, 29 May 2018 08:49:27 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id n18-v6sm7682020wrj.58.2018.05.29.08.49.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 08:49:27 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1fNgsE-0005kB-Oc; Tue, 29 May 2018 09:49:22 -0600 Date: Tue, 29 May 2018 09:49:22 -0600 From: Jason Gunthorpe To: Hans Westgaard Ry Cc: Doug Ledford , Hakon Bugge , Jack Morgenstein , Daniel Jurgens , Parav Pandit , Pravin Shedge , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number Message-ID: <20180529154922.GA18457@ziepe.ca> References: <20180529073808.27735-1-hans.westgaard.ry@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180529073808.27735-1-hans.westgaard.ry@oracle.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 09:38:08AM +0200, Hans Westgaard Ry wrote: > The agent TID is a 64 bit value split in two dwords. The least > significant dword is the TID running counter. The most significant > dword is the agent number. In the CX-3 shared port model, the mlx4 > driver uses the most significant byte of the agent number to store the > slave number, making agent numbers greater and equal to 2^24 (3 bytes) > unusable. There is no reason for this to be an ida, just do something like mad_agent_priv->agent.hi_tid = atomic_inc_return(&ib_mad_client_id) & mad_agent_priv->ib_dev->tid_mask; And have the driver set tid_mask to 3 bytes of 0xFF And no sysctl. Jason