[dpdk-dev] ethdev: fix port ID type in flow API

Message ID 20171006123233.GC3871@6wind.com (mailing list archive)
State Accepted, archived
Headers

Checks

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

Commit Message

Adrien Mazarguil Oct. 6, 2017, 12:32 p.m. UTC
  As for the testpmd flow command which uses uint16_t since the beginning by
chance, switch to portid_t for consistency.

Fixes: 14ab03825b1d ("ethdev: increase port id range")
Cc: Zhiyong Yang <zhiyong.yang@intel.com>

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 app/test-pmd/cmdline_flow.c |  6 +++---
 lib/librte_ether/rte_flow.c | 12 ++++++------
 lib/librte_ether/rte_flow.h | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
  

Comments

Thomas Monjalon Oct. 6, 2017, 2:46 p.m. UTC | #1
06/10/2017 14:32, Adrien Mazarguil:
> As for the testpmd flow command which uses uint16_t since the beginning by
> chance, switch to portid_t for consistency.
> 
> Fixes: 14ab03825b1d ("ethdev: increase port id range")
> Cc: Zhiyong Yang <zhiyong.yang@intel.com>
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied with next-net pull, thanks
  
Yang, Zhiyong Oct. 17, 2017, 7:23 a.m. UTC | #2
Hi Adrien,

Thanks for your fix patch.

Zhiyong

> -----Original Message-----
> From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> Sent: Friday, October 6, 2017 8:33 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Yang, Zhiyong
> <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH] ethdev: fix port ID type in flow API
> 
> As for the testpmd flow command which uses uint16_t since the beginning by
> chance, switch to portid_t for consistency.
> 
> Fixes: 14ab03825b1d ("ethdev: increase port id range")
> Cc: Zhiyong Yang <zhiyong.yang@intel.com>
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> ---
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 26c3e4f..b5d394d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -230,7 +230,7 @@  struct context {
 	int args_num; /**< Number of entries in args[]. */
 	uint32_t eol:1; /**< EOL has been detected. */
 	uint32_t last:1; /**< No more arguments. */
-	uint16_t port; /**< Current port ID (for completions). */
+	portid_t port; /**< Current port ID (for completions). */
 	uint32_t objdata; /**< Object-specific data. */
 	void *object; /**< Address of current object for relative offsets. */
 	void *objmask; /**< Object a full mask must be written to. */
@@ -350,7 +350,7 @@  struct token {
 /** Parser output buffer layout expected by cmd_flow_parsed(). */
 struct buffer {
 	enum index command; /**< Flow command. */
-	uint16_t port; /**< Affected port ID. */
+	portid_t port; /**< Affected port ID. */
 	union {
 		struct {
 			struct rte_flow_attr attr;
@@ -2618,7 +2618,7 @@  comp_rule_id(struct context *ctx, const struct token *token,
 
 	(void)token;
 	if (port_id_is_invalid(ctx->port, DISABLED_WARN) ||
-	    ctx->port == (uint16_t)RTE_PORT_ALL)
+	    ctx->port == (portid_t)RTE_PORT_ALL)
 		return -1;
 	port = &ports[ctx->port];
 	for (pf = port->flow_list; pf != NULL; pf = pf->next) {
diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
index 95d9ee0..e276fb2 100644
--- a/lib/librte_ether/rte_flow.c
+++ b/lib/librte_ether/rte_flow.c
@@ -132,7 +132,7 @@  rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error)
 
 /* Check whether a flow rule can be created on a given port. */
 int
-rte_flow_validate(uint8_t port_id,
+rte_flow_validate(uint16_t port_id,
 		  const struct rte_flow_attr *attr,
 		  const struct rte_flow_item pattern[],
 		  const struct rte_flow_action actions[],
@@ -152,7 +152,7 @@  rte_flow_validate(uint8_t port_id,
 
 /* Create a flow rule on a given port. */
 struct rte_flow *
-rte_flow_create(uint8_t port_id,
+rte_flow_create(uint16_t port_id,
 		const struct rte_flow_attr *attr,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
@@ -172,7 +172,7 @@  rte_flow_create(uint8_t port_id,
 
 /* Destroy a flow rule on a given port. */
 int
-rte_flow_destroy(uint8_t port_id,
+rte_flow_destroy(uint16_t port_id,
 		 struct rte_flow *flow,
 		 struct rte_flow_error *error)
 {
@@ -190,7 +190,7 @@  rte_flow_destroy(uint8_t port_id,
 
 /* Destroy all flow rules associated with a port. */
 int
-rte_flow_flush(uint8_t port_id,
+rte_flow_flush(uint16_t port_id,
 	       struct rte_flow_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
@@ -207,7 +207,7 @@  rte_flow_flush(uint8_t port_id,
 
 /* Query an existing flow rule. */
 int
-rte_flow_query(uint8_t port_id,
+rte_flow_query(uint16_t port_id,
 	       struct rte_flow *flow,
 	       enum rte_flow_action_type action,
 	       void *data,
@@ -227,7 +227,7 @@  rte_flow_query(uint8_t port_id,
 
 /* Restrict ingress traffic to the defined flow rules. */
 int
-rte_flow_isolate(uint8_t port_id,
+rte_flow_isolate(uint16_t port_id,
 		 int set,
 		 struct rte_flow_error *error)
 {
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index b1a1b97..d37b0ad 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -1168,7 +1168,7 @@  struct rte_flow_error {
  *   state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
  */
 int
-rte_flow_validate(uint8_t port_id,
+rte_flow_validate(uint16_t port_id,
 		  const struct rte_flow_attr *attr,
 		  const struct rte_flow_item pattern[],
 		  const struct rte_flow_action actions[],
@@ -1195,7 +1195,7 @@  rte_flow_validate(uint8_t port_id,
  *   rte_flow_validate().
  */
 struct rte_flow *
-rte_flow_create(uint8_t port_id,
+rte_flow_create(uint16_t port_id,
 		const struct rte_flow_attr *attr,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
@@ -1222,7 +1222,7 @@  rte_flow_create(uint8_t port_id,
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-rte_flow_destroy(uint8_t port_id,
+rte_flow_destroy(uint16_t port_id,
 		 struct rte_flow *flow,
 		 struct rte_flow_error *error);
 
@@ -1243,7 +1243,7 @@  rte_flow_destroy(uint8_t port_id,
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-rte_flow_flush(uint8_t port_id,
+rte_flow_flush(uint16_t port_id,
 	       struct rte_flow_error *error);
 
 /**
@@ -1271,7 +1271,7 @@  rte_flow_flush(uint8_t port_id,
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-rte_flow_query(uint8_t port_id,
+rte_flow_query(uint16_t port_id,
 	       struct rte_flow *flow,
 	       enum rte_flow_action_type action,
 	       void *data,
@@ -1319,7 +1319,7 @@  rte_flow_query(uint8_t port_id,
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-rte_flow_isolate(uint8_t port_id, int set, struct rte_flow_error *error);
+rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
 
 /**
  * Generic flow representation.