From patchwork Mon Dec 1 16:15:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41796 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 882CE20672 for ; Mon, 1 Dec 2014 16:16:55 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf6799548wgh.0 for ; Mon, 01 Dec 2014 08:16:54 -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=jc2F/0LIwmv+JMw0oO+pKPg9wVkY4Z3VakSkEfYfWIU=; b=iKVXk57qeb3J0w/Tjp16/K/iEmt/sPtHvg8faVRDg9uzntoccZtHnt+YU2EmY0umL+ 5zrJRXWSS1Ssi96Z5HuSqrSCvzDAWuRJQtFOz8jWaS/LXG4zVW/gm5qPVR7SIDmRUaqY XLF53zJZe2q19CoIm3Bx5lFg2wWkOXcv7R//h9IExxYWcNJ+9krCfKn+FLEitG81AnH7 Oson6o7b9Wgg5v/UPpCTlC4kyM9XgklKr3K4CEot9Ofk21ls5lacMtJ27yNRsVB7v2Mn aik/IAi6D6dieCbf5f1nFuovwUeJxssv//8ncUV+cthrE62PB0jpj5XrRpMHkWBdMZTX MEjQ== X-Gm-Message-State: ALoCoQkh721URZDWaXnuRI2yzqzMWwiKwyNI+bH03prC7hDat9c3U4txA8w34ThF95DHxwZhCn2V X-Received: by 10.180.85.72 with SMTP id f8mr11019584wiz.0.1417450614830; Mon, 01 Dec 2014 08:16:54 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.168 with SMTP id u8ls1067145lag.103.gmail; Mon, 01 Dec 2014 08:16:54 -0800 (PST) X-Received: by 10.112.161.161 with SMTP id xt1mr49716894lbb.9.1417450614578; Mon, 01 Dec 2014 08:16:54 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id o2si18065292lal.101.2014.12.01.08.16.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 08:16:54 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id l4so8938552lbv.11 for ; Mon, 01 Dec 2014 08:16:54 -0800 (PST) X-Received: by 10.152.2.165 with SMTP id 5mr9993823lav.40.1417450614445; Mon, 01 Dec 2014 08:16:54 -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 ew9csp320046lbc; Mon, 1 Dec 2014 08:16:53 -0800 (PST) X-Received: by 10.170.118.199 with SMTP id k190mr37541474ykb.128.1417450612444; Mon, 01 Dec 2014 08:16:52 -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 c12si20939463qae.103.2014.12.01.08.16.51 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Dec 2014 08:16:52 -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 1XvTec-0007H1-6I; Mon, 01 Dec 2014 16:16:50 +0000 Received: from mail-la0-f43.google.com ([209.85.215.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XvTdy-0007BG-OE for lng-odp@lists.linaro.org; Mon, 01 Dec 2014 16:16:10 +0000 Received: by mail-la0-f43.google.com with SMTP id ge10so4334174lab.2 for ; Mon, 01 Dec 2014 08:16:05 -0800 (PST) X-Received: by 10.112.150.71 with SMTP id ug7mr57704027lbb.73.1417450564967; Mon, 01 Dec 2014 08:16:04 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id ar4sm4819466lbc.48.2014.12.01.08.16.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 08:16:03 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 1 Dec 2014 19:15:36 +0300 Message-Id: <1417450537-7640-11-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1417450537-7640-1-git-send-email-maxim.uvarov@linaro.org> References: <1417450537-7640-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 10/11] 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.180 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 | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 19 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 6c8307e..7d985fb 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -552,13 +552,13 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu) if (mtu <= 0) { ODP_DBG("illegal MTU value %d\n", mtu); - return -1; + return -EINVAL; } 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) @@ -573,7 +573,7 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu) ret = ioctl(sockfd, SIOCSIFMTU, (caddr_t)&ifr); if (ret < 0) { ODP_DBG("ioctl SIOCSIFMTU error\n"); - return -1; + return ret; } return 0; @@ -589,7 +589,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) @@ -603,7 +603,7 @@ int odp_pktio_mtu(odp_pktio_t id) ret = ioctl(sockfd, SIOCGIFMTU, &ifr); if (ret < 0) { ODP_DBG("ioctl SIOCGIFMTU error\n"); - return -1; + return ret; } return ifr.ifr_mtu; @@ -619,7 +619,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) @@ -633,7 +633,7 @@ int odp_pktio_promisc_set(odp_pktio_t id, odp_bool_t enable) ret = ioctl(sockfd, SIOCGIFFLAGS, &ifr); if (ret < 0) { ODP_DBG("ioctl SIOCGIFFLAGS error\n"); - return -1; + return ret; } if (enable) @@ -644,7 +644,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; @@ -660,7 +660,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) @@ -674,7 +674,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)