Skip to contentSkip to conversation

ethdev: fix port ID type in flow API

PATCH In review Adrien Mazarguil 3 participants 3 messages Oct 6, 2017 – Oct 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
---
 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(-)
app/test-pmd/cmdline_flow.c +3 -3
index 26c3e4f..b5d394d 100644
@@ -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) {
lib/librte_ether/rte_flow.c +6 -6
index 95d9ee0..e276fb2 100644
@@ -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)
 {
lib/librte_ether/rte_flow.h +6 -6
index b1a1b97..d37b0ad 100644
@@ -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.
Signature · 1 line
2.1.4
#2 lore raw
In reply to Adrien Mazarguil

Hi Adrien,

Thanks for your fix patch.

Zhiyong

Quoted 16 lines

-----Original Message-----
From: Adrien Mazarguil [mailto:[email protected]]
Sent: Friday, October 6, 2017 8:33 PM
To: Yigit, Ferruh <[email protected]>; Yang, Zhiyong <[email protected]>
Cc: [email protected]
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 <[email protected]>

---