DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qiming Yang <qiming.yang@intel.com>
To: dev@dpdk.org
Cc: wenzhuo.lu@intel.com, wei.dai@intel.com,
	Qiming Yang <qiming.yang@intel.com>
Subject: [dpdk-dev] [PATCH 4/8] net/ixgbe/base: changed method for flash read
Date: Thu, 11 Jan 2018 00:04:35 +0800	[thread overview]
Message-ID: <20180110160439.160403-5-qiming.yang@intel.com> (raw)
In-Reply-To: <20180110160439.160403-1-qiming.yang@intel.com>

Stored host interface read resolte in two bytes instead of one byte.
And added definitions for LESM module structure.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 22 +++++++++++++++++++---
 drivers/net/ixgbe/base/ixgbe_type.h   | 10 ++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 50b9b46..bbb04de 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -4584,10 +4584,11 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 				 u32 length, u32 timeout, bool return_data)
 {
 	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
-	u16 dword_len;
+	struct ixgbe_hic_hdr *resp = (struct ixgbe_hic_hdr *)buffer;
 	u16 buf_len;
 	s32 status;
 	u32 bi;
+	u32 dword_len;
 
 	DEBUGFUNC("ixgbe_host_interface_command");
 
@@ -4617,8 +4618,23 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 		IXGBE_LE32_TO_CPUS(&buffer[bi]);
 	}
 
-	/* If there is any thing in data position pull it in */
-	buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len;
+	/*
+	 * If there is any thing in data position pull it in
+	 * Read Flash command requires reading buffer length from
+	 * two byes instead of one byte
+	 */
+	if (resp->cmd == 0x30) {
+		for (; bi < dword_len + 2; bi++) {
+			buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
+							  bi);
+			IXGBE_LE32_TO_CPUS(&buffer[bi]);
+		}
+		buf_len = (((u16)(resp->cmd_or_resp.ret_status) << 3)
+				  & 0xF00) | resp->buf_len;
+		hdr_size += (2 << 2);
+	} else {
+		buf_len = resp->buf_len;
+	}
 	if (!buf_len)
 		goto rel_out;
 
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 66a79dd..e614c10 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -2458,6 +2458,16 @@ enum {
 #define IXGBE_FW_LESM_PARAMETERS_PTR		0x2
 #define IXGBE_FW_LESM_STATE_1			0x1
 #define IXGBE_FW_LESM_STATE_ENABLED		0x8000 /* LESM Enable bit */
+#define IXGBE_FW_LESM_2_STATES_ENABLED_MASK	0x1F
+#define IXGBE_FW_LESM_2_STATES_ENABLED		0x12
+#define IXGBE_FW_LESM_STATE0_10G_ENABLED	0x6FFF
+#define IXGBE_FW_LESM_STATE1_10G_ENABLED	0x4FFF
+#define IXGBE_FW_LESM_STATE0_10G_DISABLED	0x0FFF
+#define IXGBE_FW_LESM_STATE1_10G_DISABLED	0x2FFF
+#define IXGBE_FW_LESM_PORT0_STATE0_OFFSET	0x2
+#define IXGBE_FW_LESM_PORT0_STATE1_OFFSET	0x3
+#define IXGBE_FW_LESM_PORT1_STATE0_OFFSET	0x6
+#define IXGBE_FW_LESM_PORT1_STATE1_OFFSET	0x7
 #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR	0x4
 #define IXGBE_FW_PATCH_VERSION_4		0x7
 #define IXGBE_FCOE_IBA_CAPS_BLK_PTR		0x33 /* iSCSI/FCOE block */
-- 
2.9.4

  parent reply	other threads:[~2018-01-10  8:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 16:04 [dpdk-dev] [PATCH 0/8] net/ixgbe: update base code Qiming Yang
2018-01-10  8:42 ` Lu, Wenzhuo
2018-01-10 13:34   ` Zhang, Helin
2018-01-10 16:04 ` [dpdk-dev] [PATCH 1/8] net/ixgbe/base: add common FW version functions Qiming Yang
2018-01-10 16:04 ` [dpdk-dev] [PATCH 2/8] net/ixgbe/base: increasing timeout Qiming Yang
2018-01-10 16:04 ` [dpdk-dev] [PATCH 3/8] net/ixgbe/base: x550 related bug fix Qiming Yang
2018-01-10 16:04 ` Qiming Yang [this message]
2018-01-10 16:04 ` [dpdk-dev] [PATCH 5/8] net/ixgbe/base: clear sync register during init Qiming Yang
2018-01-10 16:04 ` [dpdk-dev] [PATCH 6/8] net/ixgbe/base: update function comments Qiming Yang
2018-01-10 16:04 ` [dpdk-dev] [PATCH 7/8] net/ixgbe/base: added media type fiber fixed Qiming Yang
2018-01-10 16:04 ` [dpdk-dev] [PATCH 8/8] net/ixgbe/base: update README file Qiming Yang

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=20180110160439.160403-5-qiming.yang@intel.com \
    --to=qiming.yang@intel.com \
    --cc=dev@dpdk.org \
    --cc=wei.dai@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /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).