From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6746DA00C3 for ; Wed, 23 Feb 2022 18:14:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58D7B4114B; Wed, 23 Feb 2022 18:14:23 +0100 (CET) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mails.dpdk.org (Postfix) with ESMTP id 655C040DF6; Wed, 23 Feb 2022 18:14:21 +0100 (CET) Received: by mail-io1-f52.google.com with SMTP id c23so20533316ioi.4; Wed, 23 Feb 2022 09:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eKX1xCFId+RXIfuDZpT2BRXmLeATCAx8vlmbv8NLp+w=; b=W8FIwIIJdWLlmfF6bqFAE+v0LjM+twkzgxRR7GkRmjZXcT1gDXHIcoLqmNsynh2n75 bto1VcwKUZaKzpMD5xdQa8Dv6E3Qqr7wwCGNAwihWZeqDMOEefwGHR455P23zkRC1Q9r 1JFItZzJjBLIubbS2nS7Hciz7hmB0/L0M4VWag2epBZniyweX+7f4lbz979qJjweJIKr ZSBZxHrpFJDCur2XUip0usPmiFiwCMOqVqeyEetcNPQyykihjksounCk2yAPmppa/iTk VjluCx/uZXN4Efub8Dxo74SutYWJrIJtRV2o4ofAR5r75j0B0qN9MaCvQw8shiai52ow +3Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eKX1xCFId+RXIfuDZpT2BRXmLeATCAx8vlmbv8NLp+w=; b=yeemx9n2f6342mai9WrJs10kZxNV7tjC7107HXejqfFKNEg7b06Z1oNu3OQ2LKWsKI QE4dxd0wA2NU55sl6MM/NnvS1Ktvzi2Q+vczVB24quUfg6Ejth20d/jDaIv9Wjs0w6CL qTIgSr78f7x39rD/c4ai5L0PQAkxzVrIERIT9iVT0232dwC04loSzGFRNO1CZIXlVBs5 37Ndcg9+YNDxY9M3BTJvkaP+9/cfd8Kl+CpWX9mqQCfJ44VTQpb0B5twsIskzkWfaCbZ mMJPQrksFDdYCqlgY1tAr4wlFYLHccInDaHmDAG+hOsyax5jKus5B++KCZX1mifkQj4Q 2RUw== X-Gm-Message-State: AOAM533DdkAxa8hG6eX3b6TyVT2a9Irg/qMz3w3CsvaI2N8FK+hy18qR vRdOpUpcjlnEcb2Xywj7Pq+nLlsC4+nzOAzaMU8= X-Google-Smtp-Source: ABdhPJzcBLzpFxJE/SvsRuWKdPUjAzS5uN1OoCguMc6RguyJj0CDLC/yKhWvwERHCnDP2qerIeo3tSkxseUznOVzyOc= X-Received: by 2002:a6b:fc0a:0:b0:60c:c3a:eeb9 with SMTP id r10-20020a6bfc0a000000b0060c0c3aeeb9mr340535ioh.94.1645636460775; Wed, 23 Feb 2022 09:14:20 -0800 (PST) MIME-Version: 1.0 References: <20220117140226.3019392-1-ferruh.yigit@intel.com> <20220223094919.2834940-1-rkudurumalla@marvell.com> In-Reply-To: From: Jerin Jacob Date: Wed, 23 Feb 2022 22:43:54 +0530 Message-ID: Subject: Re: [PATCH] net/cnxk: fix compilation issue for gcc12 To: Rakesh Kudurumalla , Ferruh Yigit Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev , Jerin Jacob , dpdk stable Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Wed, Feb 23, 2022 at 5:11 PM Jerin Jacob wrote: > > On Wed, Feb 23, 2022 at 3:20 PM Rakesh Kudurumalla > wrote: > > > > resolve compilation error caused due to gcc 12 version > > error: storing the address of local variable message in *error.message > > > > Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") > > > > Cc: stable@dpdk.org > > > > Reported-By: Ferruh Yigit > > > Signed-off-by: Rakesh Kudurumalla Acked-by: Jerin Jacob Updated the commit as follows and applied to dpdk-next-net-mrvl/for-next-net. Thanks net/cnxk: fix compilation issue with gcc12 Resolve following compilation error with gcc 12 version. error: storing the address of local variable message in *error.message Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") Cc: stable@dpdk.org Reported-by: Ferruh Yigit Signed-off-by: Rakesh Kudurumalla Acked-by: Jerin Jacob > > --- > > drivers/net/cnxk/cnxk_ethdev_mtr.c | 59 ++++++++++++++++++++++-------- > > 1 file changed, 44 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c > > index cc783e5f86..c8183aa12d 100644 > > --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c > > +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c > > @@ -285,15 +285,54 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id, > > return 0; > > } > > > > +static int > > +update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action) > > +{ > > + const char *str; > > + switch (act_color) { > > + case RTE_COLOR_GREEN: > > + if (action) { > > + str = "Green action is not valid"; > > + goto notsup; > > + } else { > > + str = "Green action is null"; > > + goto notvalid; > > + } > > + break; > > + case RTE_COLOR_YELLOW: > > + if (action) { > > + str = "Yellow action is not valid"; > > + goto notsup; > > + } else { > > + str = "Yellow action is null"; > > + goto notvalid; > > + } > > + break; > > + case RTE_COLOR_RED: > > + if (action) { > > + str = "Red action is not valid"; > > + goto notsup; > > + } else { > > + str = "Red action is null"; > > + goto notvalid; > > + } > > + break; > > + } > > +notsup: > > + return -rte_mtr_error_set(error, ENOTSUP, > > + RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, str); > > +notvalid: > > + return -rte_mtr_error_set(error, EINVAL, > > + RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, str); > > +} > > + > > static int > > cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev, > > struct rte_mtr_meter_policy_params *policy, > > struct rte_mtr_error *error) > > { > > - static const char *const action_color[] = {"Green", "Yellow", "Red"}; > > bool supported[RTE_COLORS] = {false, false, false}; > > const struct rte_flow_action *action; > > - char message[1024]; > > uint32_t i; > > > > RTE_SET_USED(dev); > > @@ -315,21 +354,11 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev, > > if (action->type == RTE_FLOW_ACTION_TYPE_VOID) > > supported[i] = true; > > > > - if (!supported[i]) { > > - sprintf(message, > > - "%s action is not valid", > > - action_color[i]); > > - return -rte_mtr_error_set(error, > > - ENOTSUP, > > - RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, > > - message); > > - } > > + if (!supported[i]) > > + return update_mtr_err(i, error, true); > > } > > } else { > > - sprintf(message, "%s action is null", action_color[i]); > > - return -rte_mtr_error_set(error, EINVAL, > > - RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, > > - message); > > + return update_mtr_err(i, error, false); > > } > > } > > > > -- > > 2.25.1 > >