Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5237454pxv; Wed, 21 Jul 2021 00:09:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh0kChoirMY+GVRrqkNNqkdp3KODoTMUmDmAFpWaWOPNdS4LwWBKmFFkEdsxaVfOFMorv4 X-Received: by 2002:a02:ccad:: with SMTP id t13mr29650276jap.29.1626851371892; Wed, 21 Jul 2021 00:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626851371; cv=none; d=google.com; s=arc-20160816; b=c/piK4F//+rHtfRlcwPw+x/tAYJHm40cob/0SLcJue5y9TYO+pahbN+/IU5ULeWTUP HO/Y50w6JcG422cHSb5cCYsp8rTiBQ/b3rizUt1m1oi27I8bGvrboe20iLiOe++MqyV0 V0Zu6aoIm1Du7BEOGk23yRbj/hVomr8EdwcTyBxOmRUqULHz5aaylJjcWVFCGwVECHGt 8YqbYgUonX8dU4TsjvGkoLdUjlodCfCGBSqrqysdW/XThpoJVUYtO0Itc3fN7Sgp2rwg GFcdlzfcX3dxVbcyKD+3NA7eO/DLspSXm/IDH/V24ww7qcZ9eh2C2dsVlxb4TybP2bU2 kgKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HnfkuDnO50vyMVEHJH/bGANKrH/9DBLNbdFLH3FtkNU=; b=aJwJJt/bnilpoMNJodj/WXJW2ZZu51lFY0XtmzcfGN1opt0oIzcgYIapmiWG6BOZXJ cltV3IqZ4VtZ79hrEtWWPgKdZIEQTD8kXn/MrwWVwE0mMA7EHiEa0HXBYyEyTRSbM6ie 3TBFeFtwAGpeFeuMTYyaQVzQRJxJex9sioSN2OqkjYUGLeiwzItEl+s4BzHB0T5pkk+k 9tOUs3C1aP9IhWveO9g2bUwoqDIv4zBqTKk/qtmrobrhFmtS1+3HbD1KNP05kfsl1Ag/ 5YRZVv/i7ECa1ZpqmtIZVkkxR38yAfC0HqHaxiN7UwYMxZqa6TDNlunlcLaLtZ5qBcv3 3MWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="T/uhDbnG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si26081473ilq.134.2021.07.21.00.09.19; Wed, 21 Jul 2021 00:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="T/uhDbnG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233994AbhGUG0l (ORCPT + 99 others); Wed, 21 Jul 2021 02:26:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:53138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233863AbhGUGZd (ORCPT ); Wed, 21 Jul 2021 02:25:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 53F9D601FC; Wed, 21 Jul 2021 07:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626851171; bh=08lEzRX5n8byADguPgtNpJBNzWbbiyZADO72K/GVRR0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T/uhDbnGiykZtiPZoPEmuttb7R9FOyrLc/uosMRneqB+/ceHKlqsZiXs51SxOfbPM fEIRW7K4sAS9zcBgTUUdKqZzQ4vsZn07GHp8FSrq/oTuA1i2zEbvN12ZECqYZGt52Q F4DALKxOns9+B3CZ7Vha0dBWNf2x9enjgC3yrUCX5xB6R4b2aBLchIfEU/S4f/1M+J FnRYti3mtg+c9FrjpgoBYfnAmypBXFks0iijHKwV39fHuOIuDfgWBFl7MF83IGnH9Q UNd9g+Bcg1WF4vmDruNG7t66qqLqgyQezzCsB2+A1zI1lQnBbDfKbCC+ddg1k+rxvq b495V8h7Vfq5g== Date: Wed, 21 Jul 2021 10:06:06 +0300 From: Leon Romanovsky To: Christoph Hellwig Cc: Doug Ledford , Jason Gunthorpe , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Mark Zhang Subject: Re: [PATCH rdma-next 7/7] RDMA/core: Create clean QP creations interface for uverbs Message-ID: References: <8eaf125d3bfb463e1641b6f2794203cc93d76c90.1626846795.git.leonro@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 21, 2021 at 07:48:48AM +0100, Christoph Hellwig wrote: > > +struct ib_qp *ib_create_qp_user(struct ib_device *dev, struct ib_pd *pd, > > + struct ib_qp_init_attr *attr, > > + struct ib_udata *udata, > > + struct ib_uqp_object *uobj, const char *caller); > > +static inline struct ib_qp *ib_create_qp_uverbs(struct ib_device *dev, > > + struct ib_pd *pd, > > + struct ib_qp_init_attr *attr, > > + struct ib_udata *udata, > > + struct ib_uqp_object *uobj) > > +{ > > + if (attr->qp_type == IB_QPT_XRC_TGT) > > + return ib_create_qp_user(dev, pd, attr, NULL, uobj, > > + KBUILD_MODNAME); > > + > > + return ib_create_qp_user(dev, pd, attr, udata, uobj, NULL); > > Why not always pass along the udata and caller and just not use them > in the low-level code? You will need to add some sort of "if qp tpye" for ib_create_qp_uverbs() callers, because they always provide udata != NULL. After this series, the callers look like this: 1438 qp = ib_create_qp_uverbs(device, pd, &attr, &attrs->driver_udata, obj); ^^^^^^^^^ not NULL So instead of bothering callers, I implemented it here with one "if". Thanks