[v2,1/2] examples/l3fwd-power: fix check_ptype query

Message ID 20201117184940.19218-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] examples/l3fwd-power: fix check_ptype query |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gregory Etelson Nov. 17, 2020, 6:49 p.m. UTC
  l3fwd-power uses `--parse-ptype' parameter to query egress packets
type.  Before that feature is eanbled l3fwd-power verifies PMD ability
to advertise supporrtred packet types with
rte_eth_dev_get_supported_ptypes().

The patch updates code for PMDs that register supported types after
dev_start.

Fixes: 82bea4661626 ("examples/l3fwd-power: add --parse-ptype option")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 examples/l3fwd-power/main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Comments

Thomas Monjalon Nov. 22, 2020, 5:03 p.m. UTC | #1
I was expecting a review from David Hunt.
Let's proceed.

17/11/2020 19:49, Gregory Etelson:
> l3fwd-power uses `--parse-ptype' parameter to query egress packets
> type.  Before that feature is eanbled l3fwd-power verifies PMD ability

typo: eanbled -> enabled

> to advertise supporrtred packet types with

double typo: supporrtred -> supported

> rte_eth_dev_get_supported_ptypes().

Adding the note from ethdev API description:
"
Better to invoke this API after the device is already started or rx burst
function is decided, to obtain correct supported ptypes.
"

> The patch updates code for PMDs that register supported types after
> dev_start.
> 
> Fixes: 82bea4661626 ("examples/l3fwd-power: add --parse-ptype option")
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>

Applied, thanks
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 2874285c4e..995a3b6ad7 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2707,9 +2707,7 @@  main(int argc, char **argv)
 				if (add_cb_parse_ptype(portid, queueid) < 0)
 					rte_exit(EXIT_FAILURE,
 						 "Fail to add ptype cb\n");
-			} else if (!check_ptype(portid))
-				rte_exit(EXIT_FAILURE,
-					 "PMD can not provide needed ptypes\n");
+			}
 		}
 	}
 
@@ -2740,6 +2738,11 @@  main(int argc, char **argv)
 		}
 		/* initialize spinlock for each port */
 		rte_spinlock_init(&(locks[portid]));
+
+		if (!parse_ptype)
+			if (!check_ptype(portid))
+				rte_exit(EXIT_FAILURE,
+					"PMD can not provide needed ptypes\n");
 	}
 
 	check_all_ports_link_status(enabled_port_mask);