All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alice Michael <alice.michael@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH S2-V2 06/12] i40e: Update i40e_init_dcb to return correct error
Date: Wed,  6 Feb 2019 15:08:20 -0800	[thread overview]
Message-ID: <20190206230826.24970-6-alice.michael@intel.com> (raw)
In-Reply-To: <20190206230826.24970-1-alice.michael@intel.com>

From: Chinh T Cao <chinh.t.cao@intel.com>

Modify the i40e_init_dcb to return the correct error when LLDP or DCBX
is not in operational state.

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_dcb.c  | 28 ++++++++-------------
 drivers/net/ethernet/intel/i40e/i40e_dcb.h  |  2 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c |  2 +-
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb.c b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
index 56bff8faf371..292eeb3def10 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_dcb.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
@@ -863,22 +863,23 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw)
 /**
  * i40e_init_dcb
  * @hw: pointer to the hw struct
+ * @enable_mib_change: enable mib change event
  *
  * Update DCB configuration from the Firmware
  **/
-i40e_status i40e_init_dcb(struct i40e_hw *hw)
+i40e_status i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
 {
 	i40e_status ret = 0;
 	struct i40e_lldp_variables lldp_cfg;
 	u8 adminstatus = 0;
 
 	if (!hw->func_caps.dcb)
-		return ret;
+		return I40E_NOT_SUPPORTED;
 
 	/* Read LLDP NVM area */
 	ret = i40e_read_lldp_cfg(hw, &lldp_cfg);
 	if (ret)
-		return ret;
+		return I40E_ERR_NOT_READY;
 
 	/* Get the LLDP AdminStatus for the current port */
 	adminstatus = lldp_cfg.adminstatus >> (hw->port * 4);
@@ -887,7 +888,7 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw)
 	/* LLDP agent disabled */
 	if (!adminstatus) {
 		hw->dcbx_status = I40E_DCBX_STATUS_DISABLED;
-		return ret;
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Get DCBX status */
@@ -896,26 +897,19 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw)
 		return ret;
 
 	/* Check the DCBX Status */
-	switch (hw->dcbx_status) {
-	case I40E_DCBX_STATUS_DONE:
-	case I40E_DCBX_STATUS_IN_PROGRESS:
+	if (hw->dcbx_status == I40E_DCBX_STATUS_DONE ||
+	    hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) {
 		/* Get current DCBX configuration */
 		ret = i40e_get_dcb_config(hw);
 		if (ret)
 			return ret;
-		break;
-	case I40E_DCBX_STATUS_DISABLED:
-		return ret;
-	case I40E_DCBX_STATUS_NOT_STARTED:
-	case I40E_DCBX_STATUS_MULTIPLE_PEERS:
-	default:
-		break;
+	} else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
+		return I40E_ERR_NOT_READY;
 	}
 
 	/* Configure the LLDP MIB change event */
-	ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
-	if (ret)
-		return ret;
+	if (enable_mib_change)
+		ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
 
 	return ret;
 }
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb.h b/drivers/net/ethernet/intel/i40e/i40e_dcb.h
index 2b748a60a843..ddb48ae7cce4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_dcb.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_dcb.h
@@ -124,5 +124,5 @@ i40e_status i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
 					     u8 bridgetype,
 					     struct i40e_dcbx_config *dcbcfg);
 i40e_status i40e_get_dcb_config(struct i40e_hw *hw);
-i40e_status i40e_init_dcb(struct i40e_hw *hw);
+i40e_status i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change);
 #endif /* _I40E_DCB_H_ */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 37f875f759d0..e842b143f7b4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6393,7 +6393,7 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
 		goto out;
 
 	/* Get the initial DCB configuration */
-	err = i40e_init_dcb(hw);
+	err = i40e_init_dcb(hw, true);
 	if (!err) {
 		/* Device/Function is not DCBX capable */
 		if ((!hw->func_caps.dcb) ||
-- 
2.19.2


  parent reply	other threads:[~2019-02-06 23:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 23:08 [Intel-wired-lan] [next PATCH S2-V2 01/12] i40e: Queues are reserved despite "Invalid argument" error Alice Michael
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 02/12] i40e: Implement DDP support in i40e driver Alice Michael
2019-02-13 20:14   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 03/12] i40e: don't allow changes to HW vlan stripping on active port vlans Alice Michael
2019-03-02  0:00   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 04/12] i40e: save PTP time before a device reset Alice Michael
2019-02-12 19:51   ` Keller, Jacob E
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 05/12] i40e: Fix for 10G ports LED not blinking Alice Michael
2019-02-13 20:15   ` Bowers, AndrewX
2019-02-06 23:08 ` Alice Michael [this message]
2019-02-13 20:16   ` [Intel-wired-lan] [next PATCH S2-V2 06/12] i40e: Update i40e_init_dcb to return correct error Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 07/12] i40e: Remove misleading messages for untrusted VF Alice Michael
2019-02-13 20:16   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 08/12] i40e: Changed maximum supported FW API version to 1.8 Alice Michael
2019-02-13 20:17   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 09/12] i40e: The driver now prints the API version in error message Alice Michael
2019-02-12  9:41   ` Ludkiewicz, Adam
2019-02-13 20:17   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 10/12] i40e: Report advertised link modes on 40GBASE_SR4 Alice Michael
2019-02-12  9:41   ` Ludkiewicz, Adam
2019-02-13 20:21   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 11/12] i40e: Able to add up to 16 MAC filters on an untrusted VF Alice Michael
2019-02-13 20:24   ` Bowers, AndrewX
2019-02-06 23:08 ` [Intel-wired-lan] [next PATCH S2-V2 12/12] i40e: Fix misleading error message Alice Michael
2019-02-13 20:24   ` Bowers, AndrewX
2019-02-13 18:57 ` [Intel-wired-lan] [next PATCH S2-V2 01/12] i40e: Queues are reserved despite "Invalid argument" error 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=20190206230826.24970-6-alice.michael@intel.com \
    --to=alice.michael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.