Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S32 v3 13/15] ice: Introduce and use ice_vsi_type_str
Date: Wed,  6 Nov 2019 02:05:39 -0800	[thread overview]
Message-ID: <20191106100541.48639-13-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20191106100541.48639-1-anthony.l.nguyen@intel.com>

From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>

ice_vsi_type_str converts an ice_vsi_type enum value to its string
equivalent. This is expected to help easily identify VSI types from
module print statements.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c  | 21 ++++++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_lib.h  |  2 ++
 drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++--------
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index c9e0b533da47..af7574b0624b 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -6,6 +6,24 @@
 #include "ice_lib.h"
 #include "ice_dcb_lib.h"
 
+/**
+ * ice_vsi_type_str - maps VSI type enum to string equivalents
+ * @type: VSI type enum
+ */
+const char *ice_vsi_type_str(enum ice_vsi_type type)
+{
+	switch (type) {
+	case ICE_VSI_PF:
+		return "ICE_VSI_PF";
+	case ICE_VSI_VF:
+		return "ICE_VSI_VF";
+	case ICE_VSI_LB:
+		return "ICE_VSI_LB";
+	default:
+		return "unknown";
+	}
+}
+
 /**
  * ice_vsi_ctrl_rx_rings - Start or stop a VSI's Rx rings
  * @vsi: the VSI being configured
@@ -700,7 +718,8 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
 		hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
 		break;
 	case ICE_VSI_LB:
-		dev_dbg(&pf->pdev->dev, "Unsupported VSI type %d\n", vsi->type);
+		dev_dbg(&pf->pdev->dev, "Unsupported VSI type %s\n",
+			ice_vsi_type_str(vsi->type));
 		return;
 	default:
 		dev_warn(&pf->pdev->dev, "Unknown VSI type %d\n", vsi->type);
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
index 1ec2ad98ac46..364588dfc646 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_lib.h
@@ -6,6 +6,8 @@
 
 #include "ice.h"
 
+const char *ice_vsi_type_str(enum ice_vsi_type type);
+
 int
 ice_add_mac_to_list(struct ice_vsi *vsi, struct list_head *add_list,
 		    const u8 *macaddr);
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index aaa398759548..ba9a0b74ef0d 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -4635,8 +4635,8 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type)
 		err = ice_vsi_rebuild(vsi);
 		if (err) {
 			dev_err(&pf->pdev->dev,
-				"rebuild VSI failed, err %d, VSI index %d, type %d\n",
-				err, vsi->idx, type);
+				"rebuild VSI failed, err %d, VSI index %d, type %s\n",
+				err, vsi->idx, ice_vsi_type_str(type));
 			return err;
 		}
 
@@ -4644,8 +4644,8 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type)
 		status = ice_replay_vsi(&pf->hw, vsi->idx);
 		if (status) {
 			dev_err(&pf->pdev->dev,
-				"replay VSI failed, status %d, VSI index %d, type %d\n",
-				status, vsi->idx, type);
+				"replay VSI failed, status %d, VSI index %d, type %s\n",
+				status, vsi->idx, ice_vsi_type_str(type));
 			return -EIO;
 		}
 
@@ -4658,13 +4658,13 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type)
 		err = ice_ena_vsi(vsi, false);
 		if (err) {
 			dev_err(&pf->pdev->dev,
-				"enable VSI failed, err %d, VSI index %d, type %d\n",
-				err, vsi->idx, type);
+				"enable VSI failed, err %d, VSI index %d, type %s\n",
+				err, vsi->idx, ice_vsi_type_str(type));
 			return err;
 		}
 
-		dev_info(&pf->pdev->dev, "VSI rebuilt. VSI index %d, type %d\n",
-			 vsi->idx, type);
+		dev_info(&pf->pdev->dev, "VSI rebuilt. VSI index %d, type %s\n",
+			 vsi->idx, ice_vsi_type_str(type));
 	}
 
 	return 0;
-- 
2.20.1


  parent reply	other threads:[~2019-11-06 10:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 10:05 [Intel-wired-lan] [PATCH S32 v3 01/15] ice: Use ice_ena_vsi and ice_dis_vsi in DCB configuration flow Tony Nguyen
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 02/15] ice: Add NDO callback to set the maximum per-queue bitrate Tony Nguyen
2019-11-07 18:34   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 03/15] ice: Implement DCBNL support Tony Nguyen
2019-11-07 18:35   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 04/15] ice: avoid setting features during reset Tony Nguyen
2019-11-07 18:35   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 05/15] ice: Fix to change Rx/Tx ring descriptor size via ethtool with DCBx Tony Nguyen
2019-11-07 18:36   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 06/15] ice: configure software LLDP in ice_init_pf_dcb Tony Nguyen
2019-11-07 18:37   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 07/15] ice: Check if VF is disabled for Opcode and other operations Tony Nguyen
2019-11-07 18:37   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 08/15] ice: Change max MSI-x vector_id check in cfg_irq_map Tony Nguyen
2019-11-07 18:38   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 09/15] ice: use pkg_dwnld_status instead of sq_last_status Tony Nguyen
2019-11-07 18:38   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 10/15] ice: delay less Tony Nguyen
2019-11-07 18:39   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 11/15] ice: Update enum ice_flg64_bits to current specification Tony Nguyen
2019-11-07 18:39   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 12/15] ice: remove unnecessary conditional check Tony Nguyen
2019-11-07 18:40   ` Bowers, AndrewX
2019-11-06 10:05 ` Tony Nguyen [this message]
2019-11-07 18:40   ` [Intel-wired-lan] [PATCH S32 v3 13/15] ice: Introduce and use ice_vsi_type_str Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 14/15] ice: use more accurate ICE_DBG mask types Tony Nguyen
2019-11-07 18:41   ` Bowers, AndrewX
2019-11-06 10:05 ` [Intel-wired-lan] [PATCH S32 v3 15/15] ice: print opcode when printing controlq errors Tony Nguyen
2019-11-07 18:41   ` Bowers, AndrewX
2019-11-07 18:34 ` [Intel-wired-lan] [PATCH S32 v3 01/15] ice: Use ice_ena_vsi and ice_dis_vsi in DCB configuration flow Bowers, AndrewX

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=20191106100541.48639-13-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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