[v3,3/3] net/octeon_ep: support link status

Message ID 20220822091004.22510-4-sedara@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/octeon_ep: rename driver and add features |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Sathesh B Edara Aug. 22, 2022, 9:10 a.m. UTC
  Added functionality to update link speed, duplex mode and link state.

Signed-off-by: Sathesh Edara <sedara@marvell.com>
---
 doc/guides/nics/features/octeon_ep.ini |  1 +
 drivers/net/octeon_ep/otx_ep_ethdev.c  | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
  

Patch

diff --git a/doc/guides/nics/features/octeon_ep.ini b/doc/guides/nics/features/octeon_ep.ini
index b304ff8877..305e219262 100644
--- a/doc/guides/nics/features/octeon_ep.ini
+++ b/doc/guides/nics/features/octeon_ep.ini
@@ -9,4 +9,5 @@  SR-IOV               = Y
 Linux                = Y
 x86-64               = Y
 Basic stats          = Y
+Link status          = Y
 Usage doc            = Y
diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c
index cb45bd7a8a..77def6daa1 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -387,6 +387,22 @@  otx_ep_dev_stats_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
+static int
+otx_ep_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
+{
+	RTE_SET_USED(wait_to_complete);
+
+	if (!eth_dev->data->dev_started)
+		return 0;
+	struct rte_eth_link link;
+
+	memset(&link, 0, sizeof(link));
+	link.link_status = RTE_ETH_LINK_UP;
+	link.link_speed  = RTE_ETH_SPEED_NUM_10G;
+	link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	return rte_eth_linkstatus_set(eth_dev, &link);
+}
+
 /* Define our ethernet definitions */
 static const struct eth_dev_ops otx_ep_eth_dev_ops = {
 	.dev_configure		= otx_ep_dev_configure,
@@ -399,6 +415,7 @@  static const struct eth_dev_ops otx_ep_eth_dev_ops = {
 	.dev_infos_get		= otx_ep_dev_info_get,
 	.stats_get		= otx_ep_dev_stats_get,
 	.stats_reset		= otx_ep_dev_stats_reset,
+	.link_update		= otx_ep_dev_link_update,
 };
 
 static int