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 088B4A034D for ; Wed, 23 Feb 2022 12:41:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3B12426D5; Wed, 23 Feb 2022 12:41:56 +0100 (CET) Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) by mails.dpdk.org (Postfix) with ESMTP id EAAA740E5A; Wed, 23 Feb 2022 12:41:54 +0100 (CET) Received: by mail-il1-f171.google.com with SMTP id d3so15011166ilr.10; Wed, 23 Feb 2022 03:41:54 -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=/9J2fLh2o9DkXGZG1l2052yRY9dl+9+2tJCUJaIXYpk=; b=bmzxgkqvOtz35oL2n+Axb0CB7pBnVr5+PUSaAhHG/HUAbbT/wcYb4vPbwCH/bXiEs/ WQv2CNQRI+wT7N6VDbLrpOMh5iXGx7N48+Mlt6Rixr6C9a0JML59WXCBC6Den2ZYzBSe lvICJWfanrErrY2p5tokpYXTPFtCwy9kEdgFRLJg6Uib4B7e1tloHoZ6Ce0+kZLozQcD Ez2FVlO9GuY568ZHfMAWIer6QUX5ROu6RI8tG1aooU14qL4L8TnTYvyg/pDxysbHd421 IGr4Cwdwo9lmtbktt0hah6CGsLLaEi/Us2ujE3iYfDNGG0vJKW2zx+H8aNBgclcU0+Mq 6OHg== 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=/9J2fLh2o9DkXGZG1l2052yRY9dl+9+2tJCUJaIXYpk=; b=fzjM5qG++rNiG7n26P2SApAuMEqvPdlepDMhRD+ZsUOra4gb2L5+mZB6Nnz8vk9kRt O6MCEAw4QWnsleEP+yP8Q3WL8q4T9wZ6hhM4S9TR3qLHKyFQTUK6iR3Du3fkQh0auVr3 Oepgcxepy14PMnMC6E3PLydQoP0W3tPRfKfw4cdFzL+oqR/wwPqFjAiKi/fu4p98uqoi GonKnliNbhc9GXnzMkIt+opoDQ0lVXafIH5KSr6G5sVgIuSi2VDo1zSLlsfoO5+ek/Dg f0ejJl2yalLYUb9CFpz3o3vb+U1doAWqQsElKTuWQmYlEFVD5cQ/kG6AJiNg/liKyULT X0MQ== X-Gm-Message-State: AOAM531397fN4PscQgVHXJ7XHjwRfwnF2m3NF4XoWVN7yhpqtOr7EWpG ZhURO9bFZFQseG34KCb4ZVv0FHX96qBas7hg3/U= X-Google-Smtp-Source: ABdhPJxKMe4Edk8Z/dkb/LC3iAZ9NYJr3Z1M7hBbX/n/Vsj/kzzu0TztjjmEQpQFoAmDacl3v8OEshaVDXIc0lwO7YM= X-Received: by 2002:a05:6e02:1c22:b0:2b9:dcbb:e810 with SMTP id m2-20020a056e021c2200b002b9dcbbe810mr22981580ilh.262.1645616514299; Wed, 23 Feb 2022 03:41:54 -0800 (PST) MIME-Version: 1.0 References: <20220117140226.3019392-1-ferruh.yigit@intel.com> <20220223094919.2834940-1-rkudurumalla@marvell.com> In-Reply-To: <20220223094919.2834940-1-rkudurumalla@marvell.com> From: Jerin Jacob Date: Wed, 23 Feb 2022 17:11:28 +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 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 > --- > 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 >