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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 6BB6FC11D25 for ; Thu, 20 Feb 2020 23:06:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4203B206F4 for ; Thu, 20 Feb 2020 23:06:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="k0B6QsU5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729330AbgBTXGQ (ORCPT ); Thu, 20 Feb 2020 18:06:16 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:42461 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729306AbgBTXGQ (ORCPT ); Thu, 20 Feb 2020 18:06:16 -0500 Received: by mail-qk1-f194.google.com with SMTP id o28so164758qkj.9 for ; Thu, 20 Feb 2020 15:06:15 -0800 (PST) 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=XkOTAOMcNc1IVEFTEsYF74ee6aJfy0dk3qnKTOfIb+o=; b=k0B6QsU55aXc/tAkmdquBVptl49yQdaKZ842RKzr52WaHd7dULw3IdWH/3cD4DX2Ct vzgkZvQQy1Uq+0syRXXzE72WJgnVuY88aFThQrEaG4B/UWwhEIbp5Vie+oejLeImU6bB ePQcuOiX6cLkW9ioPjlECqEpDzd9cX7zHiIUmiXrKGaPXhcq9LcUsopdBx9NMlRPM0Vb BS+KnuoGiC9z0iYbX4qUK/zb/tVNIO5oLQLRRaBuXdYjQA1N6X9mPUrnwxAfxmD9hdh+ jU9Y/CLVckBWfm2hwFxcZdrb9NCExxBFXTIEQyLrEP1KkPx1CWCta5ycN78qhn1JTcfx aiIw== 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=XkOTAOMcNc1IVEFTEsYF74ee6aJfy0dk3qnKTOfIb+o=; b=nZ90lDEO0yLBmR12+zd/id+Yhby5aC+fUzXRehgj6sEdjwjaRtNJhR4Tim4FpxEHVb Obm+X81nFJsfsLdZoiTIQ4jcTfNO1wmN2HfXw0ZEC2m8IBMUPbF7a0kR8bKekpp4GQJd CAzmEJPqQDEWIwiuppn6Bwdf3TafLvQTOutSPWfJUC2EwYIiC4JvCxwXYhpdfG03Wd3u JV8bNLY80FxKIdnhSkdKMmif260wGnXxS4jrvbHXy8sYx4DDIrwO8gJY2FAkMAjP3lX4 G/5irVCwWAzB1BjcXPrP+1SQpSeVjtUUr0OWs8YE6cdm/EhiOQxC0Rit7HO8DVqGiuc9 nGpw== X-Gm-Message-State: APjAAAV1qv71EIYsP9Xwb5N/yW/MskPu1+IxJKHFCTwxYzgW7aOaSNKu EHypoYjcwee9oq4xMocjbs5uHQ== X-Google-Smtp-Source: APXvYqyWOy7fG5gEgq1f8u7XI/wrD9auB5FL3ePxqOteIFSD2ZS6mfTCkbk/jTsqRKHx4mECWkaJYQ== X-Received: by 2002:a37:4a16:: with SMTP id x22mr30918089qka.88.1582239975412; Thu, 20 Feb 2020 15:06:15 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id 65sm542770qtf.95.2020.02.20.15.06.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Feb 2020 15:06:14 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1j4uta-0002gS-9M; Thu, 20 Feb 2020 19:06:14 -0400 Date: Thu, 20 Feb 2020 19:06:14 -0400 From: Jason Gunthorpe To: Parav Pandit Cc: "Saleem, Shiraz" , "Kirsher, Jeffrey T" , "davem@davemloft.net" , "gregkh@linuxfoundation.org" , "Ismail, Mustafa" , "netdev@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "nhorman@redhat.com" , "sassmann@redhat.com" Subject: Re: [RFC PATCH v4 10/25] RDMA/irdma: Add driver framework definitions Message-ID: <20200220230614.GF31668@ziepe.ca> References: <20200212191424.1715577-1-jeffrey.t.kirsher@intel.com> <20200212191424.1715577-11-jeffrey.t.kirsher@intel.com> <6f01d517-3196-1183-112e-8151b821bd72@mellanox.com> <9DD61F30A802C4429A01CA4200E302A7C60C94AF@fmsmsx124.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Thu, Feb 20, 2020 at 10:24:05PM +0000, Parav Pandit wrote: > > > > From: Saleem, Shiraz > > Sent: Tuesday, February 18, 2020 2:43 PM > > To: Parav Pandit ; Kirsher, Jeffrey T > > ; davem@davemloft.net; > > gregkh@linuxfoundation.org > > Cc: Ismail, Mustafa ; netdev@vger.kernel.org; > > linux-rdma@vger.kernel.org; nhorman@redhat.com; sassmann@redhat.com; > > jgg@ziepe.ca > > Subject: RE: [RFC PATCH v4 10/25] RDMA/irdma: Add driver framework > > definitions > > > > [..] > > > > > > +static int irdma_devlink_reload_up(struct devlink *devlink, > > > > + struct netlink_ext_ack *extack) { > > > > + struct irdma_dl_priv *priv = devlink_priv(devlink); > > > > + union devlink_param_value saved_value; > > > > + const struct virtbus_dev_id *id = priv->vdev->matched_element; > > > > > > Like irdma_probe(), struct iidc_virtbus_object *vo is accesible for the given > > priv. > > > Please use struct iidc_virtbus_object for any sharing between two drivers. > > > matched_element modification inside the virtbus match() function and > > > accessing pointer to some driver data between two driver through this > > > matched_element is not appropriate. > > > > We can possibly avoid matched_element and driver data look up here. > > But fundamentally, at probe time (see irdma_gen_probe) the irdma driver > > needs to know which generation type of vdev we bound to. i.e. i40e or ice ? > > since we support both. > > And based on it, extract the driver specific virtbus device object, i.e > > i40e_virtbus_device vs iidc_virtbus_object and init that device. > > > > Accessing driver_data off the vdev matched entry in irdma_virtbus_id_table > > is how we know this generation info and make the decision. > > > If there is single irdma driver for two different virtbus device > types, it is better to have two instances of > virtbus_register_driver() with different matching string/id. Yes, I think this also makes sense The probe mechanism should include the entry pointer like PCI does for probe so that the driver knows what to do. Jason