From: Adrien Mazarguil Date: Tue, 10 Jan 2017 13:08:27 +0000 (+0100) Subject: ethdev: modify flow API error function X-Git-Tag: spdx-start~5196 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a757583e55fd8c6c0907537f794105a2707c5188;p=dpdk.git ethdev: modify flow API error function 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 --- diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c index d98fb1b333..aaa70d68cb 100644 --- a/lib/librte_ether/rte_flow.c +++ b/lib/librte_ether/rte_flow.c @@ -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)); } diff --git a/lib/librte_ether/rte_flow_driver.h b/lib/librte_ether/rte_flow_driver.h index cc97785b50..da5749d520 100644 --- a/lib/librte_ether/rte_flow_driver.h +++ b/lib/librte_ether/rte_flow_driver.h @@ -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; } /**