netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Omer Shpigelman <oshpigelman@habana.ai>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"ogabbay@kernel.org" <ogabbay@kernel.org>,
	Zvika Yehudai <zyehudai@habana.ai>
Subject: Re: [PATCH 11/15] RDMA/hbl: add habanalabs RDMA driver
Date: Wed, 17 Jul 2024 10:36:07 +0300	[thread overview]
Message-ID: <20240717073607.GF5630@unreal> (raw)
In-Reply-To: <ca6c3901-c0c5-4f35-934b-2b4c9f1a61dc@habana.ai>

On Wed, Jul 17, 2024 at 07:08:59AM +0000, Omer Shpigelman wrote:
> On 7/16/24 16:40, Jason Gunthorpe wrote:
> > On Sun, Jul 14, 2024 at 10:18:12AM +0000, Omer Shpigelman wrote:
> >> On 7/12/24 16:08, Jason Gunthorpe wrote:
> >>> [You don't often get email from jgg@ziepe.ca. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >>>
> >>> On Fri, Jun 28, 2024 at 10:24:32AM +0000, Omer Shpigelman wrote:
> >>>
> >>>> We need the core driver to access the IB driver (and to the ETH driver as
> >>>> well). As you wrote, we can't use exported symbols from our IB driver nor
> >>>> rely on function pointers, but what about providing the core driver an ops
> >>>> structure? meaning exporting a register function from the core driver that
> >>>> should be called by the IB driver during auxiliary device probe.
> >>>> Something like:
> >>>>
> >>>> int hbl_cn_register_ib_aux_dev(struct auxiliary_device *adev,
> >>>>                              struct hbl_ib_ops *ops)
> >>>> {
> >>>> ...
> >>>> }
> >>>> EXPORT_SYMBOL(hbl_cn_register_ib_aux_dev);
> >>>
> >>> Definately do not do some kind of double-register like this.
> >>>
> >>> The auxiliary_device scheme can already be extended to provide ops for
> >>> each sub device.
> >>>
> >>> Like
> >>>
> >>> struct habana_driver {
> >>>    struct auxiliary_driver base;
> >>>    const struct habana_ops *ops;
> >>> };
> >>>
> >>> If the ops are justified or not is a different question.
> >>>
> >>
> >> Well, I suggested this double-register option because I got a comment that
> >> the design pattern of embedded ops structure shouldn't be used.
> >> So I'm confused now...
> > 
> > Yeah, don't stick ops in random places, but the device_driver is the
> > right place.
> > 
> 
> Sorry, let me explain again. My original code has an ops structure
> exactly like you are suggesting now (see struct hbl_aux_dev in the first
> patch of the series). But I was instructed not to use this ops structure
> and to rely on exported symbols for inter-driver communication.
> I'll be happy to use this ops structure like in your example rather than
> converting my code to use exported symbols.
> Leon - am I missing anything? what's the verdict here?

You are missing the main sentence from Jason's response:  "don't stick ops in random places".

It is fine to have ops in device driver, so the core driver can call them. However, in your
original code, you added ops everywhere. It caused to the need to implement module reference
counting and crazy stuff like calls to lock and unlock functions from the aux driver to the core.

Verdict is still the same. Core driver should provide EXPORT_SYMBOLs, so the aux driver can call
them directly and enjoy from proper module loading and unloading.

The aux driver can have ops in the device driver, so the core driver can call them to perform something
specific for that aux driver.

Calls between aux drivers should be done via the core driver.

Thanks

  reply	other threads:[~2024-07-17  7:36 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  8:21 [PATCH 00/15] Introduce HabanaLabs network drivers Omer Shpigelman
2024-06-13  8:21 ` [PATCH 01/15] net: hbl_cn: add habanalabs Core Network driver Omer Shpigelman
2024-06-13 13:01   ` Przemek Kitszel
2024-06-13 14:16     ` Przemek Kitszel
2024-06-17  8:08     ` Omer Shpigelman
2024-06-17 11:48       ` Leon Romanovsky
2024-06-18  7:28         ` Omer Shpigelman
2024-06-15  0:05   ` Stephen Hemminger
2024-06-17  8:14     ` Omer Shpigelman
2024-06-17 14:05   ` Markus Elfring
2024-06-17 15:02     ` Andrew Lunn
2024-06-18  7:51       ` Omer Shpigelman
2024-06-13  8:21 ` [PATCH 02/15] net: hbl_cn: memory manager component Omer Shpigelman
2024-06-13  8:21 ` [PATCH 03/15] net: hbl_cn: physical layer support Omer Shpigelman
2024-06-13  8:21 ` [PATCH 04/15] net: hbl_cn: QP state machine Omer Shpigelman
2024-06-17 13:18   ` Leon Romanovsky
2024-06-18  5:50     ` Omer Shpigelman
2024-06-18  7:08       ` Leon Romanovsky
2024-06-18  7:58         ` Omer Shpigelman
2024-06-18  9:00           ` Leon Romanovsky
2024-06-24  7:24             ` Omer Shpigelman
2024-06-13  8:21 ` [PATCH 05/15] net: hbl_cn: memory trace events Omer Shpigelman
2024-06-13  8:21 ` [PATCH 06/15] net: hbl_cn: debugfs support Omer Shpigelman
2024-06-19 18:35   ` Sunil Kovvuri Goutham
2024-06-21 10:17     ` Omer Shpigelman
2024-06-21 10:30       ` Sunil Kovvuri Goutham
2024-06-23  7:25         ` Omer Shpigelman
2024-06-21 15:33       ` Andrew Lunn
2024-06-23  6:57         ` Omer Shpigelman
2024-06-23 15:02           ` Andrew Lunn
2024-06-24  7:21             ` Omer Shpigelman
2024-06-24  9:22             ` Leon Romanovsky
2024-12-17 10:00             ` Avri Kehat
2024-12-17 10:52               ` Andrew Lunn
2024-06-13  8:22 ` [PATCH 07/15] net: hbl_cn: gaudi2: ASIC register header files Omer Shpigelman
2024-06-13  8:22 ` [PATCH 08/15] net: hbl_cn: gaudi2: ASIC specific support Omer Shpigelman
2024-06-13  8:22 ` [PATCH 09/15] net: hbl_en: add habanalabs Ethernet driver Omer Shpigelman
2024-06-13 21:49   ` Andrew Lunn
2024-06-18  6:58     ` Omer Shpigelman
2024-06-18 14:19       ` Andrew Lunn
2024-06-19  7:16         ` Omer Shpigelman
2024-06-19  8:01           ` Przemek Kitszel
2024-06-19 12:15             ` Omer Shpigelman
2024-06-19 15:21           ` Jakub Kicinski
2024-06-20  8:43             ` Omer Shpigelman
2024-06-20 13:51               ` Jakub Kicinski
2024-06-20 19:14                 ` Andrew Lunn
2024-06-23 14:48                   ` Omer Shpigelman
2024-06-19 16:13           ` Andrew Lunn
2024-06-23  6:22             ` Omer Shpigelman
2024-06-23 14:46               ` Andrew Lunn
2024-06-26 10:13                 ` Omer Shpigelman
2024-06-26 14:13                   ` Andrew Lunn
2024-06-30  7:11                     ` Omer Shpigelman
2024-06-14 22:48   ` Joe Damato
2024-06-16  1:04     ` Andrew Lunn
2024-06-18 19:37     ` Omer Shpigelman
2024-06-18 21:19       ` Stephen Hemminger
2024-06-19 12:13         ` Omer Shpigelman
2024-06-15  0:10   ` Stephen Hemminger
2024-06-19 12:07     ` Omer Shpigelman
2024-06-15  0:16   ` Stephen Hemminger
2024-06-18 19:39     ` Omer Shpigelman
2024-06-19 15:40       ` Andrew Lunn
2024-06-20  8:36         ` Omer Shpigelman
2024-06-15 10:55   ` Zhu Yanjun
2024-06-18 11:16     ` Omer Shpigelman
2024-06-15 17:13   ` Zhu Yanjun
2024-06-16  1:08     ` Andrew Lunn
2024-06-13  8:22 ` [PATCH 10/15] net: hbl_en: gaudi2: ASIC specific support Omer Shpigelman
2024-06-13  8:22 ` [PATCH 11/15] RDMA/hbl: add habanalabs RDMA driver Omer Shpigelman
2024-06-13 19:18   ` Leon Romanovsky
2024-06-17 17:43     ` Omer Shpigelman
2024-06-17 19:04       ` Leon Romanovsky
2024-06-18 11:08         ` Omer Shpigelman
2024-06-18 12:58           ` Leon Romanovsky
2024-06-19  9:27             ` Omer Shpigelman
2024-06-19 10:52               ` Leon Romanovsky
2024-06-24  8:47                 ` Omer Shpigelman
2024-06-24  9:10                   ` Leon Romanovsky
2024-06-28 10:24                 ` Omer Shpigelman
2024-06-30 13:29                   ` Leon Romanovsky
2024-07-01 10:46                     ` Omer Shpigelman
2024-07-01 12:46                       ` Leon Romanovsky
2024-07-12 13:08                   ` Jason Gunthorpe
2024-07-14 10:18                     ` Omer Shpigelman
2024-07-16 13:40                       ` Jason Gunthorpe
2024-07-17  7:08                         ` Omer Shpigelman
2024-07-17  7:36                           ` Leon Romanovsky [this message]
2024-07-17 10:51                             ` Omer Shpigelman
2024-07-17 11:56                               ` Jason Gunthorpe
2024-07-17 12:33                               ` Leon Romanovsky
2024-07-18  6:54                                 ` Omer Shpigelman
2024-07-18  8:31                                   ` Leon Romanovsky
2024-06-18 16:01           ` Przemek Kitszel
2024-06-19  9:34             ` Omer Shpigelman
2024-06-17 14:17   ` Jason Gunthorpe
2024-06-19  9:39     ` Omer Shpigelman
2024-06-13  8:22 ` [PATCH 12/15] RDMA/hbl: direct verbs support Omer Shpigelman
2024-06-13  8:22 ` [PATCH 13/15] accel/habanalabs: network scaling support Omer Shpigelman
2024-06-19 18:41   ` Sunil Kovvuri Goutham
2024-06-21 10:21     ` Omer Shpigelman
2024-06-13  8:22 ` [PATCH 14/15] accel/habanalabs/gaudi2: CN registers header files Omer Shpigelman
2024-06-13  8:22 ` [PATCH 15/15] accel/habanalabs/gaudi2: network scaling support Omer Shpigelman
2024-06-17 12:34 ` [PATCH 00/15] Introduce HabanaLabs network drivers Alexander Lobakin
2024-06-19 11:40   ` Omer Shpigelman
2024-06-19 16:33 ` Jiri Pirko
2024-06-20  5:37   ` Omer Shpigelman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240717073607.GF5630@unreal \
    --to=leon@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=oshpigelman@habana.ai \
    --cc=zyehudai@habana.ai \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).