Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp661582pxb; Wed, 29 Sep 2021 07:13:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/f6wdSTM6RFiTkt91Q4S48bWzKssPt1raHEDjVEzVcj0l80gQ4jzo0CoBrlID5Nh1MtMa X-Received: by 2002:a17:90a:734a:: with SMTP id j10mr189830pjs.14.1632924781470; Wed, 29 Sep 2021 07:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632924781; cv=none; d=google.com; s=arc-20160816; b=zlCuOSPVLcborAuM1U9LHnWtBL0DEZw9JvipCGA7204ryXKIZwViPQWeeEtd8sCAu9 3mMI1IEr3rCkuORk16BxhMUBI/6rxncOOuPgnkWpVAbR+D172/9S20xnTh5zSUVBfS9O oW5DjrNza+5Y7XP+Q3I0Y6jVEIB4DB6rjLGi1D6eIR4QRz/yFGz9W9sPoGZTSrBT9tMk R7T38v6dyKd9td0z6zC0UpI1iW+wn8LmSPZFcNdHCp+SSxuB+BOiUi3/zw2YkSh34Mk9 8peW5SYUfF1oZsyfXrUevzYKdmQsw7WFKvTVqT4EeBbq6RT2GxQLRfOCTaCodczPZS8f d0rg== 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=i/FV9itv4vVrtgEA7rMhj/PGK7/MxEEJkyN22L2Va2k=; b=a8bsfmOSW/odR2yLv0UazUHaSsk7ysJoE8TKgo9XH+c7oxsVKdb40I8kYoARPdaY0A PxIiVZonfx6aqQezW3E7x7Jt4LWKx8djoSx19he95f8JVlEiPtziZnpt8bUfZ8YxirCf joN2S9FBPHdUHIwm4vW91CWwcIueFP16KRlgTZzMWv5r3Nwb+O7uKKlBJHgpguGhsTOt Z8U22oSeqNFppNqmx9m2ZPsgKYacu4CfxK8eRYwVQ0Eew2c25t8210tgtwb5sq7I/iJq qSZzMAg2EQv6bc9nJTBXeSg41d7bTQ6XQu3Yh0LMloRB+p0Bb65n0HSiWE/qOxT9o0Da 3F6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SaKUa75e; 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 q26si2915571pfn.170.2021.09.29.07.12.47; Wed, 29 Sep 2021 07:13:01 -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=SaKUa75e; 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 S1343963AbhI2NAO (ORCPT + 99 others); Wed, 29 Sep 2021 09:00:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:59828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343889AbhI2NAN (ORCPT ); Wed, 29 Sep 2021 09:00:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A9B661211; Wed, 29 Sep 2021 12:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632920312; bh=j2Wb33as6mzdBS3YhKeavZz4SfbOKLPsDU6YQXmeqwo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SaKUa75ehCfoIF0ddeLIUF8v+AG+MGe8xIP1UF82TZq9Zhr8OiGNBT4OWN1arr0Wo HXdbxucj0JELyLM6WgOgi0QnGFaPrKBFAdbLTMcABabCcAmv/BbcSkOpEcZOpw5rbn yepoi2ngSz4JdfabJCC1QdWw7qIShD+f5xZIBNdMzO4r6y8wNW24kYxkt7m1J70MbV vip1XtOWNXBDrjfMr6hzHPMBExjy7c2Fo4g54lbP3ZxJfPoX0sd+9RIFKXgbKLx4wv VxoveKPIqj3dkPR9vyfrom4xKSP64IlJ/+Ykph9Uyd/pOaMDDog2Q0WveAlEflJZ65 mZVaPXMg79IxA== Date: Wed, 29 Sep 2021 15:58:28 +0300 From: Leon Romanovsky To: Greg Kroah-Hartman Cc: "David S . Miller" , Jakub Kicinski , 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 02:25:00PM +0200, Greg Kroah-Hartman wrote: > 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? Sorted by name. It simplifies future addition of new commands and removes useless fraction where place new line. Thanks > > thanks, > > greg k-h