From: Balazs Nemeth <balazs.nemeth@intel.com>
To: dev@dpdk.org
Cc: Balazs Nemeth <balazs.nemeth@intel.com>
Subject: [dpdk-dev] [PATCH] ixgbe_vf: Fix getting link state
Date: Wed, 17 Dec 2014 13:22:34 +0000 [thread overview]
Message-ID: <1418822554-1493-1-git-send-email-balazs.nemeth@intel.com> (raw)
This patch fixes checking the link state of a virtual function. If the
state has already been checked, it does not need to be checked
again. Previously, get_link_status in the ixgbe_hw struct was
used to track if the information had already been updated, but this
field was always set to false.
Signed-off-by: Balazs Nemeth <balazs.nemeth@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h | 2 +-
lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c | 14 ++++++++------
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 8 +++++++-
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
index c67d462..07bba75 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
@@ -3573,7 +3573,7 @@ struct ixgbe_mac_info {
u32 max_rx_queues;
u32 orig_autoc;
u8 san_mac_rar_index;
- bool get_link_status;
+ bool have_link_status;
u32 orig_autoc2;
u16 max_msix_vectors;
bool arc_subsystem_valid;
diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c
index e6b6c51..6cc7d7f 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c
@@ -550,10 +550,13 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
UNREFERENCED_1PARAMETER(autoneg_wait_to_complete);
/* If we were hit with a reset drop the link */
- if (!mbx->ops.check_for_rst(hw, 0) || !mbx->timeout)
- mac->get_link_status = true;
+ if (!mbx->ops.check_for_rst(hw, 0) || !mbx->timeout) {
+ mac->have_link_status = false;
+ ret_val = -1;
+ goto out;
+ }
- if (!mac->get_link_status)
+ if (mac->have_link_status)
goto out;
/* if link status is down no point in checking to see if pf is up */
@@ -610,10 +613,10 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
/* if we passed all the tests above then the link is up and we no
* longer need to check for link
*/
- mac->get_link_status = false;
+ mac->have_link_status = true;
out:
- *link_up = !mac->get_link_status;
+ *link_up = mac->have_link_status;
return ret_val;
}
@@ -722,4 +725,3 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
return err;
}
-
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9401916..8e622ee 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -2064,7 +2064,7 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_eth_link link, old;
- ixgbe_link_speed link_speed;
+ ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
int link_up;
int diag;
@@ -2088,6 +2088,12 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
return 0;
}
+ if (link_speed == IXGBE_LINK_SPEED_UNKNOWN &&
+ hw->mac.have_link_status) {
+ memcpy(&link, &old, sizeof(link));
+ return 0;
+ }
+
if (link_up == 0) {
rte_ixgbe_dev_atomic_write_link_status(dev, &link);
if (link.link_status == old.link_status)
--
2.1.3
next reply other threads:[~2014-12-17 13:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 13:22 Balazs Nemeth [this message]
2014-12-17 13:24 ` Thomas Monjalon
2014-12-18 4:20 ` Choonho Son
2014-12-18 17:56 ` [dpdk-dev] [PATCH v2] " Balazs Nemeth
2014-12-19 15:34 ` Gonzalez Monroy, Sergio
2014-12-19 22:42 ` Thomas Monjalon
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=1418822554-1493-1-git-send-email-balazs.nemeth@intel.com \
--to=balazs.nemeth@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).