From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FAAFC433E0 for ; Tue, 26 May 2020 05:53:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2673820870 for ; Tue, 26 May 2020 05:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590472427; bh=AAdM7uhlBSU5ehs+9+mlt1qY+8zr0MbM3yvoY6VYgn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=HPT55ZFQ2P2m4rvCZWXA4azDqLsV7m+QH+kNAHEj6P+WTnbytM3i1RI0LcS93dYHH PR+Ir0c8HbUN+XT9Hyt+uZYWcGtr65JxU/igCr15ez1wdi3Qrq0UX8sOmP8ed4yqkV ZyYYLIvqGt2TfB0sqXY4oDYJ68ZByEfhddyJPE1I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726207AbgEZFxq (ORCPT ); Tue, 26 May 2020 01:53:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:57194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgEZFxq (ORCPT ); Tue, 26 May 2020 01:53:46 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09F7F2071A; Tue, 26 May 2020 05:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590472425; bh=AAdM7uhlBSU5ehs+9+mlt1qY+8zr0MbM3yvoY6VYgn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H7URmxayETQ2F1eyS8MzEuql1AF55+Z3pKjFmlaTAJeqVZvg603ZM9ts8AU+MSRXM JIiLxYmc+50wZvQLnXKDAxMFBwF4m3SfYFmIjTfeZ95ZbWq5U7zVPC8WZqyt45hat4 OO25n1sk2yzkVZ80C1RN6w/EY2w6wRVs9o2pYTKc= Date: Tue, 26 May 2020 08:53:42 +0300 From: Leon Romanovsky To: Kamal Heib Cc: Jason Gunthorpe , Doug Ledford , Maor Gottlieb , linux-rdma@vger.kernel.org Subject: Re: [PATCH rdma-next 04/14] RDMA/core: Allow to override device op Message-ID: <20200526055342.GP10591@unreal> References: <20200513095034.208385-1-leon@kernel.org> <20200513095034.208385-5-leon@kernel.org> <20200525142641.GA20978@ziepe.ca> <20200525232125.GA177080@kheib-workstation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200525232125.GA177080@kheib-workstation> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, May 26, 2020 at 02:21:25AM +0300, Kamal Heib wrote: > On Mon, May 25, 2020 at 11:26:41AM -0300, Jason Gunthorpe wrote: > > On Wed, May 13, 2020 at 12:50:24PM +0300, Leon Romanovsky wrote: > > > From: Maor Gottlieb > > > > > > Current device ops implementation allows only two stages "set"/"not set" > > > and requires caller to check if function pointer exists before > > > calling it. > > > > > > In order to simplify this repetitive task, let's give an option to > > > overwrite those pointers. This will allow us to set dummy functions > > > for the specific function pointers. > > > > > > Signed-off-by: Maor Gottlieb > > > Signed-off-by: Leon Romanovsky > > > --- > > > drivers/infiniband/core/device.c | 9 ++++----- > > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > > > index d9f565a779df..9486e60b42cc 100644 > > > --- a/drivers/infiniband/core/device.c > > > +++ b/drivers/infiniband/core/device.c > > > @@ -2542,11 +2542,10 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params); > > > void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops) > > > { > > > struct ib_device_ops *dev_ops = &dev->ops; > > > -#define SET_DEVICE_OP(ptr, name) \ > > > - do { \ > > > - if (ops->name) \ > > > - if (!((ptr)->name)) \ > > > - (ptr)->name = ops->name; \ > > > +#define SET_DEVICE_OP(ptr, name) \ > > > + do { \ > > > + if (ops->name) \ > > > + (ptr)->name = ops->name; \ > > > } while (0) > > > > Did you carefully check every driver to be sure it is OK with this? > > > > Maybe Kamal remembers why it was like this? > > > > Jason > > The idea was to set a specific op only once by the provider when there > is a valid function for the op, this was done to make sure that if > the op isn't supported by the provider then it will be set to NULL. This is not changed. > > I think it will be more cleaner from the provider point of view to > see which ops are supported or not supported in the provider code. by > overriding the ops in the core this will make things more confusing. Actually the patch does quite opposite, set defaults by IB/core and overwrite it by the provider later and not vice versa. The IB/core won't overwrite defined by the provider ops. From provider point of view no change. Thanks > > Thanks, > Kamal