public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches•com>
To: Saeed Mahameed <saeedm@mellanox•com>,
	"David S. Miller" <davem@davemloft•net>
Cc: netdev@vger•kernel.org, Eli Cohen <eli@mellanox•com>
Subject: Re: [net-next 01/15] net/mlx5: Update eqe_type_str() event names
Date: Thu, 15 Jun 2017 16:49:12 -0700	[thread overview]
Message-ID: <1497570552.14396.30.camel@perches.com> (raw)
In-Reply-To: <20170615214252.30140-2-saeedm@mellanox.com>

On Fri, 2017-06-16 at 00:42 +0300, Saeed Mahameed wrote:
> From: Eli Cohen <eli@mellanox•com>
> 
> Add missing NIC_VPORT_CHANGE event.
> 
> Signed-off-by: Eli Cohen <eli@mellanox•com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox•com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> index 0ed8e90ba54f..23048247d827 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> @@ -157,6 +157,8 @@ static const char *eqe_type_str(u8 type)
>  		return "MLX5_EVENT_TYPE_PAGE_FAULT";
>  	case MLX5_EVENT_TYPE_PPS_EVENT:
>  		return "MLX5_EVENT_TYPE_PPS_EVENT";
> +	case MLX5_EVENT_TYPE_NIC_VPORT_CHANGE:
> +		return "MLX5_EVENT_TYPE_NIC_VPORT_CHANGE";
>  	case MLX5_EVENT_TYPE_FPGA_ERROR:
>  		return "MLX5_EVENT_TYPE_FPGA_ERROR";
>  	default:

Maybe one day convert this to use a macro
to reduce the case/string duplication.

Maybe what ath9k uses:
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 74 ++++++++++------------------
 1 file changed, 26 insertions(+), 48 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 0ed8e90ba54f..3e79de07c3ee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -110,55 +110,33 @@ static struct mlx5_eqe *next_eqe_sw(struct mlx5_eq *eq)
 
 static const char *eqe_type_str(u8 type)
 {
+#define case_rtn_string(val) case val: return #val
 	switch (type) {
-	case MLX5_EVENT_TYPE_COMP:
-		return "MLX5_EVENT_TYPE_COMP";
-	case MLX5_EVENT_TYPE_PATH_MIG:
-		return "MLX5_EVENT_TYPE_PATH_MIG";
-	case MLX5_EVENT_TYPE_COMM_EST:
-		return "MLX5_EVENT_TYPE_COMM_EST";
-	case MLX5_EVENT_TYPE_SQ_DRAINED:
-		return "MLX5_EVENT_TYPE_SQ_DRAINED";
-	case MLX5_EVENT_TYPE_SRQ_LAST_WQE:
-		return "MLX5_EVENT_TYPE_SRQ_LAST_WQE";
-	case MLX5_EVENT_TYPE_SRQ_RQ_LIMIT:
-		return "MLX5_EVENT_TYPE_SRQ_RQ_LIMIT";
-	case MLX5_EVENT_TYPE_CQ_ERROR:
-		return "MLX5_EVENT_TYPE_CQ_ERROR";
-	case MLX5_EVENT_TYPE_WQ_CATAS_ERROR:
-		return "MLX5_EVENT_TYPE_WQ_CATAS_ERROR";
-	case MLX5_EVENT_TYPE_PATH_MIG_FAILED:
-		return "MLX5_EVENT_TYPE_PATH_MIG_FAILED";
-	case MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR:
-		return "MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR";
-	case MLX5_EVENT_TYPE_WQ_ACCESS_ERROR:
-		return "MLX5_EVENT_TYPE_WQ_ACCESS_ERROR";
-	case MLX5_EVENT_TYPE_SRQ_CATAS_ERROR:
-		return "MLX5_EVENT_TYPE_SRQ_CATAS_ERROR";
-	case MLX5_EVENT_TYPE_INTERNAL_ERROR:
-		return "MLX5_EVENT_TYPE_INTERNAL_ERROR";
-	case MLX5_EVENT_TYPE_PORT_CHANGE:
-		return "MLX5_EVENT_TYPE_PORT_CHANGE";
-	case MLX5_EVENT_TYPE_GPIO_EVENT:
-		return "MLX5_EVENT_TYPE_GPIO_EVENT";
-	case MLX5_EVENT_TYPE_PORT_MODULE_EVENT:
-		return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT";
-	case MLX5_EVENT_TYPE_REMOTE_CONFIG:
-		return "MLX5_EVENT_TYPE_REMOTE_CONFIG";
-	case MLX5_EVENT_TYPE_DB_BF_CONGESTION:
-		return "MLX5_EVENT_TYPE_DB_BF_CONGESTION";
-	case MLX5_EVENT_TYPE_STALL_EVENT:
-		return "MLX5_EVENT_TYPE_STALL_EVENT";
-	case MLX5_EVENT_TYPE_CMD:
-		return "MLX5_EVENT_TYPE_CMD";
-	case MLX5_EVENT_TYPE_PAGE_REQUEST:
-		return "MLX5_EVENT_TYPE_PAGE_REQUEST";
-	case MLX5_EVENT_TYPE_PAGE_FAULT:
-		return "MLX5_EVENT_TYPE_PAGE_FAULT";
-	case MLX5_EVENT_TYPE_PPS_EVENT:
-		return "MLX5_EVENT_TYPE_PPS_EVENT";
-	case MLX5_EVENT_TYPE_FPGA_ERROR:
-		return "MLX5_EVENT_TYPE_FPGA_ERROR";
+	case_rtn_string(MLX5_EVENT_TYPE_COMP);
+	case_rtn_string(MLX5_EVENT_TYPE_PATH_MIG);
+	case_rtn_string(MLX5_EVENT_TYPE_COMM_EST);
+	case_rtn_string(MLX5_EVENT_TYPE_SQ_DRAINED);
+	case_rtn_string(MLX5_EVENT_TYPE_SRQ_LAST_WQE);
+	case_rtn_string(MLX5_EVENT_TYPE_SRQ_RQ_LIMIT);
+	case_rtn_string(MLX5_EVENT_TYPE_CQ_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_WQ_CATAS_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_PATH_MIG_FAILED);
+	case_rtn_string(MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_WQ_ACCESS_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_SRQ_CATAS_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_INTERNAL_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_PORT_CHANGE);
+	case_rtn_string(MLX5_EVENT_TYPE_GPIO_EVENT);
+	case_rtn_string(MLX5_EVENT_TYPE_PORT_MODULE_EVENT);
+	case_rtn_string(MLX5_EVENT_TYPE_REMOTE_CONFIG);
+	case_rtn_string(MLX5_EVENT_TYPE_DB_BF_CONGESTION);
+	case_rtn_string(MLX5_EVENT_TYPE_STALL_EVENT);
+	case_rtn_string(MLX5_EVENT_TYPE_CMD);
+	case_rtn_string(MLX5_EVENT_TYPE_PAGE_REQUEST);
+	case_rtn_string(MLX5_EVENT_TYPE_PAGE_FAULT);
+	case_rtn_string(MLX5_EVENT_TYPE_PPS_EVENT);
+	case_rtn_string(MLX5_EVENT_TYPE_FPGA_ERROR);
+	case_rtn_string(MLX5_EVENT_TYPE_NIC_VPORT_CHANGE);
 	default:
 		return "Unrecognized event";
 	}

  reply	other threads:[~2017-06-15 23:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 21:42 [pull request][net-next 00/15] Mellanox mlx5 updates and cleanups 2017-06-16 Saeed Mahameed
2017-06-15 21:42 ` [net-next 01/15] net/mlx5: Update eqe_type_str() event names Saeed Mahameed
2017-06-15 23:49   ` Joe Perches [this message]
2017-06-21  8:56     ` Saeed Mahameed
2017-06-15 21:42 ` [net-next 02/15] net/mlx5: Fix some spelling mistakes Saeed Mahameed
2017-06-15 21:42 ` [net-next 03/15] net/mlx5: Avoid using multiple blank lines Saeed Mahameed
2017-06-15 21:42 ` [net-next 04/15] net/mlx5: Avoid blank lines before/after closing/opening braces Saeed Mahameed
2017-06-15 21:42 ` [net-next 05/15] net/mlx5: Align to match opening parenthesis Saeed Mahameed
2017-06-15 21:42 ` [net-next 06/15] net/mlx5: Avoid space after casting Saeed Mahameed
2017-06-15 21:42 ` [net-next 07/15] net/mlx5: Undo LAG upon request to create virtual functions Saeed Mahameed
2017-06-15 21:42 ` [net-next 08/15] net/mlx5e: Use function to map aRFS into traffic type Saeed Mahameed
2017-06-15 21:42 ` [net-next 09/15] net/mlx5e: Fix typo in warning if CQ moderation is not supported Saeed Mahameed
2017-06-15 21:42 ` [net-next 10/15] net/mlx5e: Rename physical symbol errors counter Saeed Mahameed
2017-06-15 21:42 ` [net-next 11/15] net/mlx5e: Reduce number of heap allocated buffers for update stats Saeed Mahameed
2017-06-20 12:36   ` David Laight
2017-06-21  8:12     ` Gal Pressman
2017-06-15 21:42 ` [net-next 12/15] net/mlx5e: Move and optimize query out of buffer function Saeed Mahameed
2017-06-15 21:42 ` [net-next 13/15] net/mlx5e: Optimize update stats work Saeed Mahameed
2017-06-15 21:42 ` [net-next 14/15] net/mlx5: Expose command polling interface Saeed Mahameed
2017-06-15 21:42 ` [net-next 15/15] net/mlx5: Add fast unload support in shutdown flow Saeed Mahameed
2017-06-16 19:25 ` [pull request][net-next 00/15] Mellanox mlx5 updates and cleanups 2017-06-16 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497570552.14396.30.camel@perches.com \
    --to=joe@perches$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eli@mellanox$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=saeedm@mellanox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox