From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82B78C35247 for ; Mon, 3 Feb 2020 17:10:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DF9920721 for ; Mon, 3 Feb 2020 17:10:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729016AbgBCRKL (ORCPT ); Mon, 3 Feb 2020 12:10:11 -0500 Received: from mga17.intel.com ([192.55.52.151]:18792 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727434AbgBCRKL (ORCPT ); Mon, 3 Feb 2020 12:10:11 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2020 09:10:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,398,1574150400"; d="scan'208";a="278802407" Received: from jekeller-mobl1.amr.corp.intel.com (HELO [134.134.177.86]) ([134.134.177.86]) by FMSMGA003.fm.intel.com with ESMTP; 03 Feb 2020 09:10:10 -0800 Subject: Re: [PATCH 01/15] devlink: prepare to support region operations From: Jacob Keller To: Jiri Pirko Cc: netdev@vger.kernel.org, valex@mellanox.com, linyunsheng@huawei.com, lihong.yang@intel.com References: <20200130225913.1671982-1-jacob.e.keller@intel.com> <20200130225913.1671982-2-jacob.e.keller@intel.com> <20200203113529.GC2260@nanopsycho> <375672b9-5464-c25e-da7b-e435cc505a5c@intel.com> Organization: Intel Corporation Message-ID: <91f0e32d-4992-d954-d315-09fdc8382883@intel.com> Date: Mon, 3 Feb 2020 09:10:10 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <375672b9-5464-c25e-da7b-e435cc505a5c@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2/3/2020 9:07 AM, Jacob Keller wrote: > On 2/3/2020 3:35 AM, Jiri Pirko wrote: >> Thu, Jan 30, 2020 at 11:58:56PM CET, jacob.e.keller@intel.com wrote: >>> Modify the devlink region code in preparation for adding new operations >>> on regions. >>> >>> Create a devlink_region_ops structure, and move the name pointer from >>> within the devlink_region structure into the ops structure (similar to >>> the devlink_health_reporter_ops). >>> >>> This prepares the regions to enable support of additional operations in >>> the future such as requesting snapshots, or accessing the region >>> directly without a snapshot. >>> >>> Signed-off-by: Jacob Keller >>> --- >>> drivers/net/ethernet/mellanox/mlx4/crdump.c | 25 ++++++++++++--------- >>> drivers/net/netdevsim/dev.c | 6 ++++- >>> include/net/devlink.h | 17 ++++++++++---- >>> net/core/devlink.c | 23 ++++++++++--------- >>> 4 files changed, 45 insertions(+), 26 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/mellanox/mlx4/crdump.c b/drivers/net/ethernet/mellanox/mlx4/crdump.c >>> index 64ed725aec28..4cea64033919 100644 >>> --- a/drivers/net/ethernet/mellanox/mlx4/crdump.c >>> +++ b/drivers/net/ethernet/mellanox/mlx4/crdump.c >>> @@ -38,8 +38,13 @@ >>> #define CR_ENABLE_BIT_OFFSET 0xF3F04 >>> #define MAX_NUM_OF_DUMPS_TO_STORE (8) >>> >>> -static const char *region_cr_space_str = "cr-space"; >>> -static const char *region_fw_health_str = "fw-health"; >> >> Just leave these as are and use in ops and messages. It is odd to use >> ops.name in the message. >> > > So this produces the following errors, not 100% sure how to resolve: > > >> drivers/net/ethernet/mellanox/mlx4/crdump.c:45:10: error: initializer element is not constant >> 45 | .name = region_cr_space_str, >> | ^~~~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/mellanox/mlx4/crdump.c:45:10: note: (near initialization for ‘region_cr_space_ops.name’) >> drivers/net/ethernet/mellanox/mlx4/crdump.c:49:10: error: initializer element is not constant >> 49 | .name = region_fw_health_str, >> | ^~~~~~~~~~~~~~~~~~~~ > > > Thanks, > Jake > Heh, this is fixed by using static const char * const , to ensure that the compiler realizes both the pointer and the contents are constant. Thanks, Jake