DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] ixgbe: fix x550 shutdown API issue
Date: Tue, 16 Jun 2015 16:07:49 +0800	[thread overview]
Message-ID: <1434442069-22208-1-git-send-email-wenzhuo.lu@intel.com> (raw)

For there're only laser ports on x550 before, we only considered laser
ports for the testpmd CLIs "port start/stop ...". Now we have new x550
devices which have copper ports. Use the API for copper to enable/disable
these ports.

And also let the testpmd CLI "set link-up/down ..." support copper
ports.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 44 +++++++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7414a2e..ac7608e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1522,8 +1522,13 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 			goto error;
 	}
 
-	/* Turn on the laser */
-	ixgbe_enable_tx_laser(hw);
+	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) {
+		/* Turn on the copper */
+		ixgbe_set_phy_power(hw, true);
+	} else {
+		/* Turn on the laser */
+		ixgbe_enable_tx_laser(hw);
+	}
 
 	err = ixgbe_check_link(hw, &speed, &link_up, 0);
 	if (err)
@@ -1643,8 +1648,13 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 		     vf < dev->pci_dev->max_vfs; vf++)
 		vfinfo[vf].clear_to_send = false;
 
-	/* Turn off the laser */
-	ixgbe_disable_tx_laser(hw);
+	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) {
+		/* Turn off the copper */
+		ixgbe_set_phy_power(hw, false);
+	} else {
+		/* Turn off the laser */
+		ixgbe_disable_tx_laser(hw);
+	}
 
 	ixgbe_dev_clear_queues(dev);
 
@@ -1670,7 +1680,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 }
 
 /*
- * Set device link up: enable tx laser.
+ * Set device link up: enable tx.
  */
 static int
 ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
@@ -1686,18 +1696,21 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 			return -ENOTSUP;
 		}
 #endif
+	}
+
+	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) {
+		/* Turn on the copper */
+		ixgbe_set_phy_power(hw, true);
+	} else {
 		/* Turn on the laser */
 		ixgbe_enable_tx_laser(hw);
-		return 0;
 	}
 
-	PMD_INIT_LOG(ERR, "Set link up is not supported by device id 0x%x",
-		     hw->device_id);
-	return -ENOTSUP;
+	return 0;
 }
 
 /*
- * Set device link down: disable tx laser.
+ * Set device link down: disable tx.
  */
 static int
 ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
@@ -1713,14 +1726,17 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 			return -ENOTSUP;
 		}
 #endif
+	}
+
+	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) {
+		/* Turn off the copper */
+		ixgbe_set_phy_power(hw, false);
+	} else {
 		/* Turn off the laser */
 		ixgbe_disable_tx_laser(hw);
-		return 0;
 	}
 
-	PMD_INIT_LOG(ERR, "Set link down is not supported by device id 0x%x",
-		     hw->device_id);
-	return -ENOTSUP;
+	return 0;
 }
 
 /*
-- 
1.9.3

             reply	other threads:[~2015-06-16  8:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16  8:07 Wenzhuo Lu [this message]
2015-06-17  9:32 ` Ananyev, Konstantin
2015-06-22 15:28   ` 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=1434442069-22208-1-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).