patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/cnxk: fix compilation issue for gcc12
       [not found] <20220117140226.3019392-1-ferruh.yigit@intel.com>
@ 2022-02-23  9:49 ` Rakesh Kudurumalla
  2022-02-23 11:41   ` Jerin Jacob
  2022-02-23  9:55 ` Rakesh Kudurumalla
  1 sibling, 1 reply; 4+ messages in thread
From: Rakesh Kudurumalla @ 2022-02-23  9:49 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, jerinj, Rakesh Kudurumalla, stable

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

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Change-Id: Ia4cf18471ae33691c34229ab537f208389e0f780
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] net/cnxk: fix compilation issue for gcc12
       [not found] <20220117140226.3019392-1-ferruh.yigit@intel.com>
  2022-02-23  9:49 ` [PATCH] net/cnxk: fix compilation issue for gcc12 Rakesh Kudurumalla
@ 2022-02-23  9:55 ` Rakesh Kudurumalla
  1 sibling, 0 replies; 4+ messages in thread
From: Rakesh Kudurumalla @ 2022-02-23  9:55 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, jerinj, Rakesh Kudurumalla, stable

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

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
v2 : removed changeid

 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/cnxk: fix compilation issue for gcc12
  2022-02-23  9:49 ` [PATCH] net/cnxk: fix compilation issue for gcc12 Rakesh Kudurumalla
@ 2022-02-23 11:41   ` Jerin Jacob
  2022-02-23 17:13     ` Jerin Jacob
  0 siblings, 1 reply; 4+ messages in thread
From: Jerin Jacob @ 2022-02-23 11:41 UTC (permalink / raw)
  To: Rakesh Kudurumalla, Ferruh Yigit
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	dpdk-dev, Jerin Jacob, dpdk stable

On Wed, Feb 23, 2022 at 3:20 PM Rakesh Kudurumalla
<rkudurumalla@marvell.com> 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 <ferruh.yigit@intel.com>

> Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/cnxk: fix compilation issue for gcc12
  2022-02-23 11:41   ` Jerin Jacob
@ 2022-02-23 17:13     ` Jerin Jacob
  0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2022-02-23 17:13 UTC (permalink / raw)
  To: Rakesh Kudurumalla, Ferruh Yigit
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	dpdk-dev, Jerin Jacob, dpdk stable

On Wed, Feb 23, 2022 at 5:11 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Wed, Feb 23, 2022 at 3:20 PM Rakesh Kudurumalla
> <rkudurumalla@marvell.com> 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 <ferruh.yigit@intel.com>
>
> > Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>


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 <ferruh.yigit@intel.com>
    Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
    Acked-by: Jerin Jacob <jerinj@marvell.com>


> > ---
> >  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
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-23 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220117140226.3019392-1-ferruh.yigit@intel.com>
2022-02-23  9:49 ` [PATCH] net/cnxk: fix compilation issue for gcc12 Rakesh Kudurumalla
2022-02-23 11:41   ` Jerin Jacob
2022-02-23 17:13     ` Jerin Jacob
2022-02-23  9:55 ` Rakesh Kudurumalla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).