Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4176126pxk; Tue, 8 Sep 2020 12:39:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs0PcBAW7ULV4kq3d80jeqxynroB9vgWl+GkEWEM7SBXZkGIO8JAWMk3zBLs1BY5+8Bsdi X-Received: by 2002:a17:906:cf8b:: with SMTP id um11mr25640ejb.540.1599593968412; Tue, 08 Sep 2020 12:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599593968; cv=none; d=google.com; s=arc-20160816; b=kL61V/yT2xNygPJZvBCrJ+aHM8tnfcuZ0K7rr478rhbU2flvINigCTy+r+bjTBG/Lk YFPSljOJYZnbAi4pWuS8mg4Vwu+fMy2MTz/HwKayTb3WoXUtZADjvwfg2n+m2Lq883N2 7EE/d+2cNvGMzck9Qm0p4h2UFfeO0p6JNGWMbFlO2o1EUcatWDC2UcZkGzN55NwV5psV 50NSZN6VOxBwEWWKm/IKavMBiZwMvnihOTzKZ8tZuLxgUqxS5zfos1jstG8l21Kis63o MKPyiycgo4jaeTF9H4W9KPiQ7jvmJn+BQTW2szFx5dJR31QfQa/iev4ttJG6fOE3omBs 7GqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3sHaSQTtEpVgxZUhYIXCbmOjlv1gJeOQFw7S/Ryj3Pc=; b=lONPSXL2gx6H/DR5vt+6cdmxv7ITBLRlTiNzNMcsMrPZdA/oxW8mNgXPfTdDA1XMgZ jImxzCMilCt0FR4SwJCtglTYA9jTLriYq3l80UL8ObeOXz6M92kF7d+QdgOtLcYfxhO/ aWWRKdoc5pMksjXaHnEGRX3Q1IF9WESvEOiQna6MUpB3zmiM5cuct8wGlqLmo/G+niYl 2q59L5lsSMQ9tY/cMnGQH3fXjdR31XZDBZKb0vqs3QEk0c39LSiurcg+405SomrZjVcP 6TrDbpFDKU1PVu2N/fz/IxGj8CMVYlfMU32boOA0SEyZsuP8w9JaU27gPYnUNbMYNeR9 nNhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=N+Mcjpgu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si62680edi.84.2020.09.08.12.39.05; Tue, 08 Sep 2020 12:39:28 -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=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=N+Mcjpgu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731959AbgIHTfB (ORCPT + 99 others); Tue, 8 Sep 2020 15:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730898AbgIHP5a (ORCPT ); Tue, 8 Sep 2020 11:57:30 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DA59C0610E4 for ; Tue, 8 Sep 2020 07:12:46 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id z23so22701851ejr.13 for ; Tue, 08 Sep 2020 07:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3sHaSQTtEpVgxZUhYIXCbmOjlv1gJeOQFw7S/Ryj3Pc=; b=N+McjpguiDc1n2EPL915Ma7152SAViSTeH5vg+8E2QpOulQuWlPUZ3LyTfQVBU+7m6 +M9vLe8Pja0QusLmo+vTDbDgyyLzhiOiEypL8xPNu6N3QXXgG3MrnudvKDgVjprnS0Hm QCzY2WSk02O3OpNLKbcRu6PBeXb1bqiUtfIPErkmpkBjggnmbeJCXAwk/9J8LEGHiZ0o QfRVvy6MUF4lPe/vMD8uXnFrvsoq+0iADzFL+EOuwtcNnRrwblYGBN2ZDZUda4lWArS7 +4e+KhcoqGkTtd6H3/OcOsFq7Ahnhb0q1JCtMoBoQ4E31Yirm4gnEqXYhX4EyIPuIGOB FHmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3sHaSQTtEpVgxZUhYIXCbmOjlv1gJeOQFw7S/Ryj3Pc=; b=VQXWL3h+zTeChTSEhnKkzDAwAGNfrPzelcihCZhT58+h0uXUGoU+aeNGuP6iW3iy6l g5ALsg03ZDRS9Wn6AR7ZM+23j/TR8gVTsLEO512RXRTQcVY4bt5JnMTbovbMolhhHBgX rMvE+xom0B7ibf20TLZf9m8rZbTqctGyIZDDwkH1dVL6P44S0i1OWrVgRefqK+X46drR wGcttDb8zQj4AntGnBHjLjQIIReoitpvAkCVxLFPRcTq87Z3AVMAN9kKAJnwCGQ2YVjk ZQ8N1p9Zz6poMXz8ZNFPq0iTHTt8zgXiMA5IYA3DW5w2LRy/sKJl4aTpONECTuTxHuoT H4Vw== X-Gm-Message-State: AOAM532cn7obhTB7dEOeGqz8nnuP3gMINTm54wstYl3wE74gY1/9lEw+ os8NF+bmgp8FYX7VVCXhe2bBtQpm0GMUY5P3 X-Received: by 2002:a17:906:2b06:: with SMTP id a6mr25615230ejg.209.1599574365078; Tue, 08 Sep 2020 07:12:45 -0700 (PDT) Received: from localhost ([86.61.181.4]) by smtp.gmail.com with ESMTPSA id w14sm17826958ejn.36.2020.09.08.07.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 07:12:44 -0700 (PDT) Date: Tue, 8 Sep 2020 16:12:43 +0200 From: Jiri Pirko To: Aya Levin Cc: "David S. Miller" , Jakub Kicinski , Jiri Pirko , netdev@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Ido Schimmel , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next RFC v1 1/4] devlink: Wrap trap related lists and ops in trap_mngr Message-ID: <20200908141243.GO2997@nanopsycho.orion> References: <1599060734-26617-1-git-send-email-ayal@mellanox.com> <1599060734-26617-2-git-send-email-ayal@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1599060734-26617-2-git-send-email-ayal@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wed, Sep 02, 2020 at 05:32:11PM CEST, ayal@mellanox.com wrote: >Bundle the trap related lists: trap_list, trap_group_list and >trap_policer_list and trap ops like: trap_init, trap_fini, >trap_action_set... together in trap_mngr. This will be handy in the >coming patches in the set introducing traps in devlink port context. >With trap_mngr, code reuse is much simpler. > >Signed-off-by: Aya Levin >--- > drivers/net/ethernet/mellanox/mlxsw/core.c | 4 + > include/net/devlink.h | 59 ++++--- > net/core/devlink.c | 255 +++++++++++++++++------------ You need to split this. You do at least 2 separate things in one patch. Please check it. > 3 files changed, 188 insertions(+), 130 deletions(-) > >diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c >index 08d101138fbe..97460f47e537 100644 >--- a/drivers/net/ethernet/mellanox/mlxsw/core.c >+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c >@@ -1285,6 +1285,9 @@ static const struct devlink_ops mlxsw_devlink_ops = { > .sb_occ_tc_port_bind_get = mlxsw_devlink_sb_occ_tc_port_bind_get, > .info_get = mlxsw_devlink_info_get, > .flash_update = mlxsw_devlink_flash_update, >+}; >+ >+static const struct devlink_trap_ops mlxsw_devlink_traps_ops = { > .trap_init = mlxsw_devlink_trap_init, > .trap_fini = mlxsw_devlink_trap_fini, > .trap_action_set = mlxsw_devlink_trap_action_set, >@@ -1321,6 +1324,7 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, > err = -ENOMEM; > goto err_devlink_alloc; > } >+ devlink_traps_ops(devlink, &mlxsw_devlink_traps_ops); > } > > mlxsw_core = devlink_priv(devlink); >diff --git a/include/net/devlink.h b/include/net/devlink.h >index 8f3c8a443238..d387ea5518c3 100644 >--- a/include/net/devlink.h >+++ b/include/net/devlink.h >@@ -21,6 +21,13 @@ > #include > > struct devlink_ops; >+struct devlink_trap_ops; >+struct devlink_trap_mngr { "Mngr" is odd. This is not a manager. Just a common place to store trap-related things. Perhaps just "devlink_traps"? >+ struct list_head trap_list; >+ struct list_head trap_group_list; >+ struct list_head trap_policer_list; >+ const struct devlink_trap_ops *trap_ops; >+}; [...]