From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f172.google.com (mail-wj0-f172.google.com [209.85.210.172]) by dpdk.org (Postfix) with ESMTP id 752CE1E2F for ; Tue, 10 Jan 2017 14:08:59 +0100 (CET) Received: by mail-wj0-f172.google.com with SMTP id kq3so36637298wjc.0 for ; Tue, 10 Jan 2017 05:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oyI/fEHBHGbteRNY2mKnpv3Bh4kK1gYlJQfuz6Fbzik=; b=F7UEuqGTGPWed0Xaeqh5JZMI//UL0yrvQ0Uw8b3WOQ4rOIdmdSHViKOIwXcv9gvTi/ QZGvqZCbBMV4tbXVH3k0vu8KOcL/jdt9v1/3rLT8jZvTuUU2Z51qtMFB8dPKaUQJ77TH Ya5avUN9EXgFXcrlKDoqmZPhLxfuP5YlhEHGwNfHhY7TlSGd+Xw4jQdum0ma+1ap+FQ/ ZcmH27bC/kkJdw2NDUD5CteRiCfGQ1+L9A7dlI8VtLI4u9NQ1Ih6s9TjZj1EVn7yecwm qDc3y/VgPV9wg8xbofgA54+5YXUFxE2J3tv0U/FEol7YVjrwc0GV6k7GXCkPv1XqbymU ZDTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oyI/fEHBHGbteRNY2mKnpv3Bh4kK1gYlJQfuz6Fbzik=; b=WW7xQ9FPUq6YwFkjLvJzDHAdFqwbSW6b81AjquqO/NE/Bgg47+qxW+qutVl+EM4HM5 Uaz6+P3TB+eXyr+phrH1oflU6cYAXeT3WujhV1jzFmRMGns4MAlmW/fuqbI1Ep98ok4z OVkOmhVGuyr5Ey/+43UgeOtGEceMiZuMH3EvouEs1LsMu1PeHqrR5/jG1VvhGEMAhB+1 tOmAvMsmyKkQCvKX1QktlrJfWV8aVraE2GvqTi5Ck4redRLG0tSBj888UpsqVaVOYUw2 GGjQP/o0TyplHQskqIjYERb2TX5JE+AOChgMxCYJbhoowesgZMPPA+Q1yr4tlabaQOMi LrSw== X-Gm-Message-State: AIkVDXLP66C5KfMWV3MYAXdIV7nWjgotoW6qyBEvTFMW9/PolxBMJeFyrPtUC8XrbSxEmMf7 X-Received: by 10.194.246.105 with SMTP id xv9mr2070438wjc.202.1484053739192; Tue, 10 Jan 2017 05:08:59 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id g6sm3225809wjp.28.2017.01.10.05.08.56 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 10 Jan 2017 05:08:58 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Cc: Nelio Laranjeiro , Wei Zhao , Beilei Xing Date: Tue, 10 Jan 2017 14:08:27 +0100 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 2/5] ethdev: modify flow API's error setting function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 13:08:59 -0000 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 Cc: Nelio Laranjeiro Cc: Wei Zhao Cc: Beilei Xing --- lib/librte_ether/rte_flow.c | 24 ++++++++++++------------ lib/librte_ether/rte_flow_driver.h | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c index d98fb1b..aaa70d6 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 cc97785..d020536 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 (\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; } /** -- 2.1.4