From patchwork Mon Dec 1 14:08:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41781 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E17320672 for ; Mon, 1 Dec 2014 14:10:05 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf6565922wgh.0 for ; Mon, 01 Dec 2014 06:10:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=/RBmASs4i2kVCblxBhtOpSOCUnl5YKjmb/f/QT5xLfI=; b=I5+oNEedE24v53wJPUV3jD//o2gtX7bXs0dO9VfWGjCUTSudgFW+nzgqh1cvcdlFlV WL38QR+ENyd6/KpMkCyM8EZDGx8YvM3Xp7p+4VDLnQUX/7f1dGuzCZ9xX52jMHHt1fzd Rg8grYxk9udOfnxYyyU4JNo2eJGKXQ9gXBmdszygS4pjQJ8gUwQHRUYWBgg3QFRa70kM Dmgdp4rSnYQd7QWtjfLfUCCeMyXsgTpFRgfgkO5KMLDZbObkBSK7z4RmxbJ52PNv/sLt 4Gks7tTrg+7RwaCD59T9zuDnUCZgwzAgniN5pEOpbs1OqDx8SbbsrfraAwsawHwj/il4 zAtA== X-Gm-Message-State: ALoCoQlp6lf7ThqlilzLXmi2e4GWLGplOTCLHvWXHYLZzrPgOV79R0bBU2cv/cMJs40ahp1u9pgl X-Received: by 10.194.95.74 with SMTP id di10mr6280100wjb.0.1417443004804; Mon, 01 Dec 2014 06:10:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.166 with SMTP id t6ls1281693lat.20.gmail; Mon, 01 Dec 2014 06:10:04 -0800 (PST) X-Received: by 10.112.135.197 with SMTP id pu5mr56878755lbb.22.1417443003956; Mon, 01 Dec 2014 06:10:03 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id vu2si5253465lbb.38.2014.12.01.06.10.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 06:10:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so9407685lbj.23 for ; Mon, 01 Dec 2014 06:10:03 -0800 (PST) X-Received: by 10.152.3.67 with SMTP id a3mr12929658laa.56.1417443003537; Mon, 01 Dec 2014 06:10:03 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp293333lbc; Mon, 1 Dec 2014 06:10:02 -0800 (PST) X-Received: by 10.140.46.52 with SMTP id j49mr66515917qga.30.1417443001371; Mon, 01 Dec 2014 06:10:01 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j7si791744qaf.48.2014.12.01.06.10.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Dec 2014 06:10:01 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvRfr-0000yy-9V; Mon, 01 Dec 2014 14:09:59 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvRfC-0000uM-8t for lng-odp@lists.linaro.org; Mon, 01 Dec 2014 14:09:18 +0000 Received: by mail-lb0-f175.google.com with SMTP id u10so8482888lbd.6 for ; Mon, 01 Dec 2014 06:09:12 -0800 (PST) X-Received: by 10.152.4.233 with SMTP id n9mr41575780lan.61.1417442952683; Mon, 01 Dec 2014 06:09:12 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id or5sm4739750lbb.42.2014.12.01.06.09.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 06:09:11 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 1 Dec 2014 17:08:48 +0300 Message-Id: <1417442928-20680-11-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417442928-20680-1-git-send-email-maxim.uvarov@linaro.org> References: <1417442928-20680-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 10/10] API and linux-generic: pktio update return codes X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Update return codes to readable values. Signed-off-by: Maxim Uvarov --- platform/linux-generic/include/api/odp_packet_io.h | 16 +++++++--------- platform/linux-generic/odp_packet_io.c | 12 ++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index 1190355..0b9e34b 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -137,8 +137,7 @@ odp_pktio_t odp_pktio_get_input(odp_packet_t pkt); * use. * * @retval 0 on success. - * @retval -1 if specified mtu can not be handled. - * @retval -1 on any other error or illegal input parameters. + * @retval -ERROR on error. */ int odp_pktio_set_mtu(odp_pktio_t id, int mtu); @@ -148,7 +147,7 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu); * @param[in] id ODP packet IO handle. * * @retval MTU value >0 on success. - * @retval -1 on any error or not existance pktio id. + * @retval -ERROR on error. */ int odp_pktio_mtu(odp_pktio_t id); @@ -159,8 +158,7 @@ int odp_pktio_mtu(odp_pktio_t id); * @param[in] enable 1 enabled, 0 disabled. * * @retval 0 on success. - * @retval -1 on a bad pktio id - * @retval -1 any other error + * @retval -ERROR on error. */ int odp_pktio_promisc_set(odp_pktio_t id, odp_bool_t enable); @@ -171,8 +169,7 @@ int odp_pktio_promisc_set(odp_pktio_t id, odp_bool_t enable); * * @retval 1 if promiscuous mode is enabled. * @retval 0 if promiscuous mode is disabled. - * @retval -1 on a bad pktio id - * @retval -1 any other error + * @retval -ERROR on error. */ int odp_pktio_promisc_enabled(odp_pktio_t id); @@ -183,8 +180,9 @@ int odp_pktio_promisc_enabled(odp_pktio_t id); * @param[in] mac_addr MAC address to be assigned to the interface. * @param[in] addr_size Size of the address in bytes. * - * @return 0 on success, -ERROR on error. - */ + * @retval return 0 on success + * @retval -ERROR on error. +*/ int odp_pktio_mac_addr_set(odp_pktio_t id, const unsigned char *mac_addr, size_t addr_size); diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 0f2dc33..f7b997b 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -558,7 +558,7 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu) entry = get_entry(id); if (entry == NULL) { ODP_DBG("pktio entry %d does not exist\n", id); - return -1; + return -ENOENT; } if (entry->s.pkt_sock_mmap.sockfd > -1) @@ -588,7 +588,7 @@ int odp_pktio_mtu(odp_pktio_t id) entry = get_entry(id); if (entry == NULL) { ODP_DBG("pktio entry %d does not exist\n", id); - return -1; + return -ENOENT; } if (entry->s.pkt_sock_mmap.sockfd > -1) @@ -617,7 +617,7 @@ int odp_pktio_promisc_set(odp_pktio_t id, odp_bool_t enable) entry = get_entry(id); if (entry == NULL) { ODP_DBG("pktio entry %d does not exist\n", id); - return -1; + return -ENOENT; } if (entry->s.pkt_sock_mmap.sockfd > -1) @@ -642,7 +642,7 @@ int odp_pktio_promisc_set(odp_pktio_t id, odp_bool_t enable) ret = ioctl(sockfd, SIOCSIFFLAGS, &ifr); if (ret < 0) { ODP_DBG("ioctl SIOCSIFFLAGS error\n"); - return -1; + return ret; } return 0; @@ -658,7 +658,7 @@ int odp_pktio_promisc_enabled(odp_pktio_t id) entry = get_entry(id); if (entry == NULL) { ODP_DBG("pktio entry %d does not exist\n", id); - return -1; + return -ENOENT; } if (entry->s.pkt_sock_mmap.sockfd > -1) @@ -672,7 +672,7 @@ int odp_pktio_promisc_enabled(odp_pktio_t id) ret = ioctl(sockfd, SIOCGIFFLAGS, &ifr); if (ret < 0) { ODP_DBG("ioctl SIOCGIFFLAGS error\n"); - return -1; + return ret; } if (ifr.ifr_flags & IFF_PROMISC)