Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp572144pxb; Wed, 29 Sep 2021 05:27:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVaNygkTJM9uIajlLuCip2zi5P3fGT9tKSwi4Z2DEvIG08/wRi2r6AB0jJOrLVZkmEJkbl X-Received: by 2002:aa7:94a2:0:b0:447:ce69:7601 with SMTP id a2-20020aa794a2000000b00447ce697601mr10993938pfl.46.1632918469021; Wed, 29 Sep 2021 05:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632918469; cv=none; d=google.com; s=arc-20160816; b=AkQ0WyR8sfHc4dXiqhWM3GINKYKEKuravf9qKYlJ/o/xe3F9nyiUtFvqlrRSHpnSzG 4Gjp1IktosB9YtYBqqs/54Kgy0AGuq2hrYEIZ0pmHizC4uEf1lCNGrfuK4KfpLxzx7ZD lERekvwrsiDNnhOD4kgjOWOLD856XLwrUmzu5QzXbeANNWGaHEiWJ9LJg1NeNm45LZNI 4Q88SrcsygiUYHFLj6onzRxFjaPPPHvwNLjb8Dq3ex/moAMrbd00xWyiGFUoeCY831Bo 25zDrJ9EDvsVaOwiggCpOCzN1alVv982rLPpHKDWiPNIASHTKoXID8Ce6zBMsVD0H7ll E2Pg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kUQjesyJHxTt0Sg1OsUrwodulnN6EvUtgrS3yGDAJww=; b=Veu/RWZsgM3+6d7eqKxf/TQ/AUTLkf1wu30utJPikVAAEMO4G+/AGNYa+3cvxZfMfp XhbOdKywSToRXUaBklrU2fwS22x2futoECJPwtHpbZsaruyS1koRbI/k3bYDl912oPsX v1f/L3mbwuYAMXnRyPg3F9A1R8B8spMnRXs5mlG+h3m84dtcJ23ByE0KV/ibvrfogNVw kO82qfWkIyqsexETwa6fZNQrxRAX35P7na/8rHyEMIXJmmnWNL/FZA6wmcttONT6gZF3 yuN6BeHLKWV3VjGXyTCPwbhmVxuI/+gkPkTyS7O7+/W1Ouf10Ruyinha8LU/kQBLZk7B GRsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FOgYB8oD; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si2516902pgv.338.2021.09.29.05.27.33; Wed, 29 Sep 2021 05:27:49 -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=@linuxfoundation.org header.s=korg header.b=FOgYB8oD; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343782AbhI2M1T (ORCPT + 99 others); Wed, 29 Sep 2021 08:27:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:37494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343657AbhI2M0p (ORCPT ); Wed, 29 Sep 2021 08:26:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F09DB6134F; Wed, 29 Sep 2021 12:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632918304; bh=wWhYoJmf5o0goYtd67yiGvYSKB/JovKlR7TP3Zqi99g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FOgYB8oD4xLYiT0MCbtWOdRGH09IaQNPSb9EOFkBWsnpoxLHGflJa7ENoq5BBegTA /idNuAQ88djuyX6GEANEa3D9oBEdUuEjGy3rDzcd4GQcWFa+2U/Gw+KtNXffW4v0Ud 7oDuoKWmOB12QpwjmS0H8zNQahoQsoL0nRw6FaFU= Date: Wed, 29 Sep 2021 14:25:00 +0200 From: Greg Kroah-Hartman To: Leon Romanovsky Cc: "David S . Miller" , Jakub Kicinski , Leon Romanovsky , 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 , 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 3/5] devlink: Allow set specific ops callbacks dynamically Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 03:00:44PM +0300, Leon Romanovsky wrote: > +void devlink_set_ops(struct devlink *devlink, struct devlink_ops *ops) > +{ > + struct devlink_ops *dev_ops = devlink->ops; > + > + WARN_ON(!devlink_reload_actions_valid(ops)); > + > +#define SET_DEVICE_OP(ptr, op, name) \ > + do { \ > + if ((op)->name) \ > + if (!((ptr)->name)) \ > + (ptr)->name = (op)->name; \ > + } while (0) > + > + /* Keep sorted */ > + SET_DEVICE_OP(dev_ops, ops, reload_actions); > + SET_DEVICE_OP(dev_ops, ops, reload_down); > + SET_DEVICE_OP(dev_ops, ops, reload_limits); > + SET_DEVICE_OP(dev_ops, ops, reload_up); Keep sorted in what order? And why? thanks, greg k-h