From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 03/11] ixgbe/base: sw-firmware sync for resource sharing
Date: Sun, 14 Feb 2016 16:54:58 +0800 [thread overview]
Message-ID: <1455440106-28547-4-git-send-email-wenzhuo.lu@intel.com> (raw)
In-Reply-To: <1455440106-28547-1-git-send-email-wenzhuo.lu@intel.com>
Use the PHY token, shared between sw-fw for PHY access on X550EM_a.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/rel_notes/release_16_04.rst | 5 ++
drivers/net/ixgbe/base/ixgbe_x550.c | 114 +++++++++++++++++++++++++++++++++
drivers/net/ixgbe/base/ixgbe_x550.h | 2 +
3 files changed, 121 insertions(+)
diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 1e702b7..e8f256f 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -49,6 +49,11 @@ This section should contain new features added in this release. Sample format:
Only x550em_x V1 was supported before. Now V2 is supported.
A mask for V1 and V2 is defined and used to support both.
+* **Added sw-firmware sync on X550EM_a.**
+
+ Added support for sw-firmware sync for resource sharing.
+ Use the PHY token, shared between sw-fw for PHY access on X550EM_a.
+
Resolved Issues
---------------
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 456b029..83d9c81 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -39,6 +39,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "ixgbe_phy.h"
STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed);
+static s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
+static void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
/**
* ixgbe_init_ops_X550 - Inits func ptrs and MAC type
@@ -442,6 +444,8 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
if (hw->mac.type == ixgbe_mac_X550EM_a) {
mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550a;
mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550a;
+ mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
+ mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
}
mac->ops.get_media_type = ixgbe_get_media_type_X550em;
@@ -921,6 +925,63 @@ out:
}
/**
+ * ixgbe_get_phy_token - Get the token for shared phy access
+ * @hw: Pointer to hardware structure
+ */
+
+s32 ixgbe_get_phy_token(struct ixgbe_hw *hw)
+{
+ struct ixgbe_hic_phy_token_req token_cmd;
+ s32 status;
+
+ token_cmd.hdr.cmd = FW_PHY_TOKEN_REQ_CMD;
+ token_cmd.hdr.buf_len = FW_PHY_TOKEN_REQ_LEN;
+ token_cmd.hdr.cmd_or_resp.cmd_resv = 0;
+ token_cmd.port_number = hw->bus.lan_id;
+ token_cmd.command_type = FW_PHY_TOKEN_REQ;
+ token_cmd.pad = 0;
+ status = ixgbe_host_interface_command(hw, (u32 *)&token_cmd,
+ sizeof(token_cmd),
+ IXGBE_HI_COMMAND_TIMEOUT,
+ true);
+ if (status)
+ return status;
+ if (token_cmd.hdr.cmd_or_resp.ret_status == FW_PHY_TOKEN_OK)
+ return IXGBE_SUCCESS;
+ if (token_cmd.hdr.cmd_or_resp.ret_status != FW_PHY_TOKEN_RETRY)
+ return IXGBE_ERR_FW_RESP_INVALID;
+
+ return IXGBE_ERR_TOKEN_RETRY;
+}
+
+/**
+ * ixgbe_put_phy_token - Put the token for shared phy access
+ * @hw: Pointer to hardware structure
+ */
+
+s32 ixgbe_put_phy_token(struct ixgbe_hw *hw)
+{
+ struct ixgbe_hic_phy_token_req token_cmd;
+ s32 status;
+
+ token_cmd.hdr.cmd = FW_PHY_TOKEN_REQ_CMD;
+ token_cmd.hdr.buf_len = FW_PHY_TOKEN_REQ_LEN;
+ token_cmd.hdr.cmd_or_resp.cmd_resv = 0;
+ token_cmd.port_number = hw->bus.lan_id;
+ token_cmd.command_type = FW_PHY_TOKEN_REL;
+ token_cmd.pad = 0;
+ status = ixgbe_host_interface_command(hw, (u32 *)&token_cmd,
+ sizeof(token_cmd),
+ IXGBE_HI_COMMAND_TIMEOUT,
+ true);
+ if (status)
+ return status;
+ if (token_cmd.hdr.cmd_or_resp.ret_status == FW_PHY_TOKEN_OK)
+ return IXGBE_SUCCESS;
+ return IXGBE_ERR_FW_RESP_INVALID;
+}
+
+/**
* ixgbe_write_iosf_sb_reg_x550a - Writes a value to specified register
* of the IOSF device
* @hw: pointer to hardware structure
@@ -3080,6 +3141,59 @@ void ixgbe_release_swfw_sync_X550em(struct ixgbe_hw *hw, u32 mask)
}
/**
+ * ixgbe_acquire_swfw_sync_X550a - Acquire SWFW semaphore
+ * @hw: pointer to hardware structure
+ * @mask: Mask to specify which semaphore to acquire
+ *
+ * Acquires the SWFW semaphore and get the shared phy token as needed
+ */
+static s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask)
+{
+ u32 hmask = mask & ~IXGBE_GSSR_TOKEN_SM;
+ int retries = FW_PHY_TOKEN_RETRIES;
+ s32 status = IXGBE_SUCCESS;
+
+ DEBUGFUNC("ixgbe_acquire_swfw_sync_X550a");
+
+ while (--retries) {
+ if (hmask)
+ status = ixgbe_acquire_swfw_sync_X540(hw, hmask);
+ if (status)
+ break;
+ if (!(mask & IXGBE_GSSR_TOKEN_SM))
+ break;
+ status = ixgbe_get_phy_token(hw);
+ if (status != IXGBE_ERR_TOKEN_RETRY)
+ break;
+ if (hmask)
+ ixgbe_release_swfw_sync_X540(hw, hmask);
+ msec_delay(FW_PHY_TOKEN_DELAY);
+ }
+
+ return status;
+}
+
+/**
+ * ixgbe_release_swfw_sync_X550a - Release SWFW semaphore
+ * @hw: pointer to hardware structure
+ * @mask: Mask to specify which semaphore to release
+ *
+ * Releases the SWFW semaphore and puts the shared phy token as needed
+ */
+static void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask)
+{
+ u32 hmask = mask & ~IXGBE_GSSR_TOKEN_SM;
+
+ DEBUGFUNC("ixgbe_release_swfw_sync_X550a");
+
+ if (mask & IXGBE_GSSR_TOKEN_SM)
+ ixgbe_put_phy_token(hw);
+
+ if (hmask)
+ ixgbe_release_swfw_sync_X540(hw, hmask);
+}
+
+/**
* ixgbe_handle_lasi_ext_t_x550em - Handle external Base T PHY interrupt
* @hw: pointer to hardware structure
*
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 47efa7c..a8c0a67 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -69,6 +69,8 @@ s32 ixgbe_write_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
u32 device_type, u32 data);
s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
u32 device_type, u32 *data);
+s32 ixgbe_get_phy_token(struct ixgbe_hw *);
+s32 ixgbe_put_phy_token(struct ixgbe_hw *);
s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
u32 device_type, u32 data);
s32 ixgbe_read_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
--
1.9.3
next prev parent reply other threads:[~2016-02-14 8:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 2:48 [dpdk-dev] [PATCH 00/12] update ixgbe base driver Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 01/12] ixgbe/base: update readme Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 02/12] ixgbe/base: add new devices and mac type Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 03/12] ixgeb/base: use PHY token for X550EM_a Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 04/12] ixgbe/base: set VF mac address only when acked by PF Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 05/12] ixgbe/base: always turn PHY power on when requested Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 06/12] ixgbe/base: add definition of a register for mac SGMII busy Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 07/12] ixgbe/base: support fuse for both x550em_x V1 and V2 Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 08/12] ixgbe/base: remove duplicate setting for fdir no match drop Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 09/12] ixgbe/base: consolidate MDIO speed-setting Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 10/12] ixgbe/base: use link instead of I2C combined abstraction Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 11/12] ixgbe: support new devices and mac types Wenzhuo Lu
2016-01-19 2:48 ` [dpdk-dev] [PATCH 12/12] doc: update release note for ixgbe base code update Wenzhuo Lu
2016-02-11 22:35 ` [dpdk-dev] [PATCH 00/12] update ixgbe base driver Bruce Richardson
2016-02-14 2:33 ` Lu, Wenzhuo
2016-02-14 8:54 ` [dpdk-dev] [PATCH v2 00/11] " Wenzhuo Lu
2016-02-14 8:54 ` [dpdk-dev] [PATCH v2 01/11] ixgbe/base: add x550em_a device support Wenzhuo Lu
2016-02-14 8:54 ` [dpdk-dev] [PATCH v2 02/11] ixgbe/base: add x550em_x V2 " Wenzhuo Lu
2016-02-14 8:54 ` Wenzhuo Lu [this message]
2016-02-14 8:54 ` [dpdk-dev] [PATCH v2 04/11] ixgbe/base: set VF mac addr only when acked by PF Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 05/11] ixgbe/base: ignore manageability for phy power on Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 06/11] ixgbe/base: add register definition for SGMII busy Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 07/11] ixgbe/base: fix setting flow dir flag twice Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 08/11] ixgbe/base: set MDIO speed after MAC reset Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 09/11] ixgbe/base: abstract out link read/write ops Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 10/11] ixgbe/base: update readme Wenzhuo Lu
2016-02-14 8:55 ` [dpdk-dev] [PATCH v2 11/11] ixgbe: support new devices and mac types Wenzhuo Lu
2016-02-15 21:39 ` [dpdk-dev] [PATCH v2 00/11] update ixgbe base driver Bruce Richardson
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=1455440106-28547-4-git-send-email-wenzhuo.lu@intel.com \
--to=wenzhuo.lu@intel.com \
--cc=dev@dpdk.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).