]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: modify flow API error function
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Tue, 10 Jan 2017 13:08:27 +0000 (14:08 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 11 Jan 2017 15:53:07 +0000 (16:53 +0100)
Based on initial PMD implementations of the flow API, returning the error
structure which may be NULL is useless and always discarded.

Returning the error code instead appears to be much more convenient.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
lib/librte_ether/rte_flow.c
lib/librte_ether/rte_flow_driver.h

index d98fb1b3333411263680e09d6cd54ae8e8bd155b..aaa70d68cb9d945f1d4d40b65cbd24be4d7f8510 100644 (file)
@@ -78,9 +78,9 @@ rte_flow_validate(uint8_t port_id,
                return -rte_errno;
        if (likely(!!ops->validate))
                return ops->validate(dev, attr, pattern, actions, error);
-       rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-                          NULL, rte_strerror(ENOSYS));
-       return -rte_errno;
+       return -rte_flow_error_set(error, ENOSYS,
+                                  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+                                  NULL, rte_strerror(ENOSYS));
 }
 
 /* Create a flow rule on a given port. */
@@ -116,9 +116,9 @@ rte_flow_destroy(uint8_t port_id,
                return -rte_errno;
        if (likely(!!ops->destroy))
                return ops->destroy(dev, flow, error);
-       rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-                          NULL, rte_strerror(ENOSYS));
-       return -rte_errno;
+       return -rte_flow_error_set(error, ENOSYS,
+                                  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+                                  NULL, rte_strerror(ENOSYS));
 }
 
 /* Destroy all flow rules associated with a port. */
@@ -133,9 +133,9 @@ rte_flow_flush(uint8_t port_id,
                return -rte_errno;
        if (likely(!!ops->flush))
                return ops->flush(dev, error);
-       rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-                          NULL, rte_strerror(ENOSYS));
-       return -rte_errno;
+       return -rte_flow_error_set(error, ENOSYS,
+                                  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+                                  NULL, rte_strerror(ENOSYS));
 }
 
 /* Query an existing flow rule. */
@@ -153,7 +153,7 @@ rte_flow_query(uint8_t port_id,
                return -rte_errno;
        if (likely(!!ops->query))
                return ops->query(dev, flow, action, data, error);
-       rte_flow_error_set(error, ENOSYS, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-                          NULL, rte_strerror(ENOSYS));
-       return -rte_errno;
+       return -rte_flow_error_set(error, ENOSYS,
+                                  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+                                  NULL, rte_strerror(ENOSYS));
 }
index cc97785b50034d9bc9af9739a5244253c0afa2dd..da5749d5201530ff17821c68035acfe76b03f7ed 100644 (file)
@@ -139,9 +139,9 @@ struct rte_flow_ops {
  *   Human-readable error message.
  *
  * @return
- *   Pointer to flow error structure.
+ *   Error code.
  */
-static inline struct rte_flow_error *
+static inline int
 rte_flow_error_set(struct rte_flow_error *error,
                   int code,
                   enum rte_flow_error_type type,
@@ -156,7 +156,7 @@ rte_flow_error_set(struct rte_flow_error *error,
                };
        }
        rte_errno = code;
-       return error;
+       return code;
 }
 
 /**