Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp684912pxb; Wed, 29 Sep 2021 07:39:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeKlRBIcG+IWx3pFM7gTXmvF12jtbpq4wMPQBr+ODi/J8KWQ3ExXX9CQcg3o2hbbQAGI2L X-Received: by 2002:a17:906:c05a:: with SMTP id bm26mr64991ejb.498.1632926359182; Wed, 29 Sep 2021 07:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632926359; cv=none; d=google.com; s=arc-20160816; b=p+0XncGQ6PitSO8MYFhGsKwiYt2MNbWLGqcSniDuuc5w4aEh8x4kPAA+nrXbALkuFG Ym9U/tvdz3dYamfJ+GjtLU1lLA5SAeqw7rZITA/BbeBNgFYGB+75YExzgzzVEFXbgbbW A4Iuzfubvja3njU5DK0F36NLTwxW764xNu7thnNyFmw9Hobz0NyqbFp48lJ9ZfNjY51a ud1dd/bsf1eYQsv545SjBnb+UZad9zrtefWVYwaNnayqKxQ33Ye8Pq5cV8Tx+49ppj+Y kfKmbCFwaOOKWHRw0ltXjV/ZE2ew/5qmPcJJV+WxwT7H9oL8esNtp/1J96NaX3ETKwTO Epbw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PiI6HnitmO5c/xc0lGS0YJbBWVyuRHQ2M05uGy+Qc2k=; b=UMbyJhb/yU8eyHV58pbtba+6rk68fUqTcerFJBymFogae6kQwb6ESRcTX62PhpX+F4 dgLi/Zr8wxnuwZkPC8jsxyo9GErNVX3ZWGSQPRr4kZlI+GCkSSuiX9aufi2d0nLoatSj atBp8uklE55LBN/8uoGJUG928Ca47e1VSWWTv/L5dtAwjtiplUNSV0cIFFPuPuQ+qNM3 xD/jI5LW4GVQSFRsJRiurt4hKx3Iqki92ZghznQpBnMxgeOrXBhOof3JglKB8suuFC4x awz/QyhzUe7bhnubUX5AI0dvg+0pPbh6PBIr3+47Od94tciWJwP9UfhAO0z6FjxIEVga ueJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vB3ka2ZO; 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 u22si109746edo.27.2021.09.29.07.38.54; Wed, 29 Sep 2021 07:39:19 -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=vB3ka2ZO; 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 S1344468AbhI2Oct (ORCPT + 99 others); Wed, 29 Sep 2021 10:32:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:59578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245632AbhI2Oct (ORCPT ); Wed, 29 Sep 2021 10:32:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 125FC610CC; Wed, 29 Sep 2021 14:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632925867; bh=5J9i/PjQ6jdxK2kOImSO+oQGMSYmdpfWzCpwuVBY2d0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vB3ka2ZOtDpsOdBe8FXBPJmSoNh8GSWrL0prJW6U3i/f7lX+X3AoVF5PHb8HZeOUK GoD/Qzf9Z3yZQKIaT6lcRYeT3sIxm/S+c9PP4S75v/Z3s55+mQGFuqTdMeKLDrmfKM +DRF2ViEmEPJquHp5DZYk8BhsDfoXlmMDdvOuo6KFrgnMWqq8O2LcPqpBHwf+/nzi2 rHDahLDcWWa0Tne7Z4jjLPHNC9Ad9UeEvHrboot81a0p4i4wzJVOXuZ12uZApMX1Ua zh+sR1ZnumyxcwjxXLndgN5mtewH3aref/5V7dtV7d9nIJDAmMdjXp9DwGhEE0coPQ eTzrFGTNxPsxg== Date: Wed, 29 Sep 2021 17:31:04 +0300 From: Leon Romanovsky To: Jakub Kicinski Cc: "David S . Miller" , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , drivers@pensando.io, Eric Dumazet , Felix Manlunas , Florian Fainelli , Geetha sowjanya , Greg Kroah-Hartman , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, hariprasad , Ido Schimmel , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Manish Chopra , Michael Chan , Moshe Shemesh , netdev@vger.kernel.org, oss-drivers@corigine.com, Richard Cochran , Saeed Mahameed , Salil Mehta , Satanand Burla , Shannon Nelson , Shay Drory , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vadym Kochan , Vivien Didelot , Vladimir Oltean , Yisen Zhuang Subject: Re: [PATCH net-next v1 4/5] net/mlx5: Register separate reload devlink ops for multiport device Message-ID: References: <20210929065549.43b13203@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20210929072631.437ffad9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210929072631.437ffad9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 07:26:31AM -0700, Jakub Kicinski wrote: > On Wed, 29 Sep 2021 17:16:28 +0300 Leon Romanovsky wrote: > > > > @@ -808,6 +812,9 @@ int mlx5_devlink_register(struct devlink *devlink) > > > > if (err) > > > > goto traps_reg_err; > > > > > > > > + if (!mlx5_core_is_mp_slave(dev)) > > > > + devlink_set_ops(devlink, &mlx5_devlink_reload); > > > > > > Does this work? Where do you make a copy of the ops? ???? You can't modify > > > the driver-global ops, to state the obvious. > > > > devlink_ops pointer is not constant at this stage, so why can't I copy > > reload_* pointers to the "main" devlink ops? > > > > I wanted to avoid to copy all pointers. > > Hm. I must be missing a key piece here. IIUC you want to have different > ops based on some device property. But there is only one > > static struct devlink_ops mlx5_devlink_ops; > > so how can two devlink instances in the system use that and have > different ops without a copy? No, I have two: * Base ops - mlx5_devlink_ops * Extra reload commands - mlx5_devlink_reload Thanks