Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp818491pxb; Wed, 29 Sep 2021 10:16:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJTkbmYeTcKYBaZaVVWavejVk43odXquSyPGi6bymCl46gpDnx3URZJ01Dj2lUN5nVgTdG X-Received: by 2002:a17:90a:ae18:: with SMTP id t24mr1131081pjq.92.1632935771709; Wed, 29 Sep 2021 10:16:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632935771; cv=none; d=google.com; s=arc-20160816; b=aNgc8xEbUZUK2zd4yblbu7gsegh3cPbRM0RzhrbW49GqxkLJz3GQe9gi1QZVYPXFuM 2GzC+LURyHZT7kCnYLwyaxB3VWZN4f04dJgXwkM9/jvLQ4HzMwbzf3u6qBP0c4kYFEth fM3DkXpxu2jcDPf8JB5zVdyb5WM9rurlAHlhFgZQ/+agjuq7b5CapQtTpjPzL826PrH4 2LoESjaJ7NxGb2BvbA2VeM/RsUnS+WvogwfCLo4F+XIP/5DjJgoozO7cns1ytRyHocbP 5FKp80zs9SV5seAsvLUYc1RuxrZ5qVylq4u33fhsqo9PDRh7rSiX7kUotynuVoYANqrD PHCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=XLQIBs7gdMclBJWSrHFnRmf5uV5EP2IFG7u5UvzkUDM=; b=e+bR27dyFu9QtdCaBN/LQcGIuYK3oNvLm6ROHswB0D3aLOuFBlTavBwxhGrsLgIxw6 zaUubSu5gZHMVTcAygQoGgkxnOty9iyG4m43XJCJRH/zmEm90A9huSHqcF6C/ENu7CJL YaunRzPQuI+F1l0gv8HBdwTleDGJXPftlXBcnYPvWWZ6qAqACaZmBqzZ0iRCdPPJkG1U 0KRIWAMtTyd3KjYITZcdn3pnA60VO+c7nhCWGlgQIktaVnJGJddMbO5DHTAYdqA63Mt1 wuOpVupKWOxY+kg0B2B+dEBzNGXrBFvvzj9nvmXbKrZhrsOCaKFAjwcwEhuMNoDGSoWQ 5PEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mb78hnsN; 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 k15si493638pgg.579.2021.09.29.10.15.59; Wed, 29 Sep 2021 10:16:11 -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=mb78hnsN; 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 S1344401AbhI2O2U (ORCPT + 99 others); Wed, 29 Sep 2021 10:28:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:56142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344142AbhI2O2Q (ORCPT ); Wed, 29 Sep 2021 10:28:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E40860ED4; Wed, 29 Sep 2021 14:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632925594; bh=QZUqLW+rrVYjG2fzvS4fRKLH6cZniCvIXXWbYdcka0w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mb78hnsNs4SNcPw8fEhqyXKvPGc3zCK/a99lx3QDAbg5UyOq/Rlf/LLhrDXhJVFRk Jz2Co8cuiZ4aHX6s2P3mCTRNDgvjoDeHnnk/Jh99AlKHYkMhnzpGCJ3plvD7/cJkJx uN0E1hagBwcQEKjG5TeHyQHmOxOudPFOFCYPq1NXI5mit2JZXve2AWDI5JgpdvU09A ffGQCg1Kkp8c0txxGH2UXOHctPqSnJsAMKTvYviu1uQbU1MryEaFsLG7RPT7JL0wYg wE0MHR5mFXxfeeuOyN3ZxskdmVgwuVI2JE21E3NhYRnkBK3RHggdakhx8Xh+AAIBHa qxHr8dOPnKtAg== Date: Wed, 29 Sep 2021 07:26:31 -0700 From: Jakub Kicinski To: Leon Romanovsky 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: <20210929072631.437ffad9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20210929065549.43b13203@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; > > > =20 > > > + if (!mlx5_core_is_mp_slave(dev)) > > > + devlink_set_ops(devlink, &mlx5_devlink_reload); =20 > >=20 > > Does this work? Where do you make a copy of the ops? =F0=9F=A4=94 You c= an't modify > > the driver-global ops, to state the obvious. =20 >=20 > devlink_ops pointer is not constant at this stage, so why can't I copy > reload_* pointers to the "main" devlink ops? >=20 > 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?