[dpdk-dev,2/5] examples/ip_pipeline: avoid panic if link up/down is not supported

Message ID 1490967396-2240-2-git-send-email-Andriy.Berestovskyy@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andriy Berestovskyy March 31, 2017, 1:36 p.m. UTC
  Some PMDs (mostly VFs) do not provide link up/down functionality.

Signed-off-by: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>
---
 examples/ip_pipeline/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Cristian Dumitrescu March 31, 2017, 2:17 p.m. UTC | #1
> -----Original Message-----
> From: Andriy Berestovskyy
> [mailto:Andriy.Berestovskyy@caviumnetworks.com]
> Sent: Friday, March 31, 2017 2:37 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH 2/5] examples/ip_pipeline: avoid panic if link up/down is not
> supported
> 
> Some PMDs (mostly VFs) do not provide link up/down functionality.
> 
> Signed-off-by: Andriy Berestovskyy
> <Andriy.Berestovskyy@caviumnetworks.com>
> ---

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  

Patch

diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index 1dc2a04..be148fc 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -717,7 +717,8 @@  app_link_up_internal(struct app_params *app, struct app_link_params *cp)
 
 	/* PMD link up */
 	status = rte_eth_dev_set_link_up(cp->pmd_id);
-	if (status < 0)
+	/* Do not panic if PMD does not provide link up functionality */
+	if (status < 0 && status != -ENOTSUP)
 		rte_panic("%s (%" PRIu32 "): PMD set link up error %"
 			PRId32 "\n", cp->name, cp->pmd_id, status);
 
@@ -733,7 +734,8 @@  app_link_down_internal(struct app_params *app, struct app_link_params *cp)
 
 	/* PMD link down */
 	status = rte_eth_dev_set_link_down(cp->pmd_id);
-	if (status < 0)
+	/* Do not panic if PMD does not provide link down functionality */
+	if (status < 0 && status != -ENOTSUP)
 		rte_panic("%s (%" PRIu32 "): PMD set link down error %"
 			PRId32 "\n", cp->name, cp->pmd_id, status);