netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sathya Perla <sathya.perla@avagotech.com>
To: netdev@vger.kernel.org
Subject: [PATCH net-next v2 01/10] be2net: fix VF link state transition from disabled to auto
Date: Mon, 28 Dec 2015 01:49:15 -0500	[thread overview]
Message-ID: <1451285364-9074-2-git-send-email-sathya.perla@avagotech.com> (raw)
In-Reply-To: <1451285364-9074-1-git-send-email-sathya.perla@avagotech.com>

From: Suresh Reddy <suresh.reddy@avagotech.com>

The VF link state setting transition from "disable" to "auto" does not work
due to a bug in SET_LOGICAL_LINK_CONFIG_V1 cmd in FW. This issue could not
be fixed in FW due to some backward compatibility issues it causes with
some released drivers. The issue has been fixed by introducing a new
version (v2) of the cmd from 10.6 FW onwards. In v2, to set the VF link
state to auto, both PLINK_ENABLE and PLINK_TRACK bits have to be set to 1.

The VF link state setting feature now works on Lancer chips too from
FW ver 10.6.315.0 onwards.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
---
 drivers/net/ethernet/emulex/benet/be_cmds.c | 35 +++++++++++++++++++++--------
 drivers/net/ethernet/emulex/benet/be_cmds.h |  3 ++-
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 1795c93..8083eca 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -4260,16 +4260,13 @@ err:
 	return status;
 }
 
-int be_cmd_set_logical_link_config(struct be_adapter *adapter,
-				   int link_state, u8 domain)
+int __be_cmd_set_logical_link_config(struct be_adapter *adapter,
+				     int link_state, int version, u8 domain)
 {
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_req_set_ll_link *req;
 	int status;
 
-	if (BEx_chip(adapter) || lancer_chip(adapter))
-		return -EOPNOTSUPP;
-
 	spin_lock_bh(&adapter->mcc_lock);
 
 	wrb = wrb_from_mccq(adapter);
@@ -4284,14 +4281,15 @@ int be_cmd_set_logical_link_config(struct be_adapter *adapter,
 			       OPCODE_COMMON_SET_LOGICAL_LINK_CONFIG,
 			       sizeof(*req), wrb, NULL);
 
-	req->hdr.version = 1;
+	req->hdr.version = version;
 	req->hdr.domain = domain;
 
-	if (link_state == IFLA_VF_LINK_STATE_ENABLE)
-		req->link_config |= 1;
+	if (link_state == IFLA_VF_LINK_STATE_ENABLE ||
+	    link_state == IFLA_VF_LINK_STATE_AUTO)
+		req->link_config |= PLINK_ENABLE;
 
 	if (link_state == IFLA_VF_LINK_STATE_AUTO)
-		req->link_config |= 1 << PLINK_TRACK_SHIFT;
+		req->link_config |= PLINK_TRACK;
 
 	status = be_mcc_notify_wait(adapter);
 err:
@@ -4299,6 +4297,25 @@ err:
 	return status;
 }
 
+int be_cmd_set_logical_link_config(struct be_adapter *adapter,
+				   int link_state, u8 domain)
+{
+	int status;
+
+	if (BEx_chip(adapter))
+		return -EOPNOTSUPP;
+
+	status = __be_cmd_set_logical_link_config(adapter, link_state,
+						  2, domain);
+
+	/* Version 2 of the command will not be recognized by older FW.
+	 * On such a failure issue version 1 of the command.
+	 */
+	if (base_status(status) == MCC_STATUS_ILLEGAL_REQUEST)
+		status = __be_cmd_set_logical_link_config(adapter, link_state,
+							  1, domain);
+	return status;
+}
 int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
 		    int wrb_payload_size, u16 *cmd_status, u16 *ext_status)
 {
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 91155ea..9690c3a 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -2246,7 +2246,8 @@ struct be_cmd_resp_get_iface_list {
 };
 
 /*************** Set logical link ********************/
-#define PLINK_TRACK_SHIFT	8
+#define PLINK_ENABLE            BIT(0)
+#define PLINK_TRACK             BIT(8)
 struct be_cmd_req_set_ll_link {
 	struct be_cmd_req_hdr hdr;
 	u32 link_config; /* Bit 0: UP_DOWN, Bit 9: PLINK */
-- 
2.4.1

  reply	other threads:[~2015-12-28  6:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28  6:49 [PATCH net-next v2 00/10] be2net: patch set Sathya Perla
2015-12-28  6:49 ` Sathya Perla [this message]
2015-12-28  6:49 ` [PATCH net-next v2 02/10] be2net: avoid configuring VEPA mode on BE3 Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 03/10] be2net: cleanup FW flash image related macro defines Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 04/10] be2net: move FW flash cmd code to be_cmds.c Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 05/10] be2net: log digital signature errors while flashing FW image Sathya Perla
2015-12-28  8:23   ` kbuild test robot
2015-12-28  6:49 ` [PATCH net-next v2 06/10] be2net: remove a line of code that has no effect Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 07/10] be2net: remove unused error variables Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 08/10] be2net: fix port-res desc query of GET_PROFILE_CONFIG FW cmd Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 09/10] be2net: support ethtool get-dump option Sathya Perla
2015-12-28  6:49 ` [PATCH net-next v2 10/10] be2net: bump up the driver version to 11.0.0.0 Sathya Perla
2015-12-29 20:50 ` [PATCH net-next v2 00/10] be2net: patch set David Miller
2015-12-30  6:27   ` Sathya Perla
2015-12-30 17:44     ` 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=1451285364-9074-2-git-send-email-sathya.perla@avagotech.com \
    --to=sathya.perla@avagotech.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).