From patchwork Wed Jan 28 21:28:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 43889 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1666623FFF for ; Wed, 28 Jan 2015 21:29:02 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id f15sf12980614lbj.2 for ; Wed, 28 Jan 2015 13:29:01 -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: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=gVrkzVwVFIRV5Bd1SyKAYyPBI/eorr0aIBzomUbCgA8=; b=dBdWMACE9GHxcFdLLXzPddA83RavEGIK1ri9dLOw1uh9PomHOqGFIUWMHfCvHNC7rX WzgK8qnGLwZBpKJ5xCLEdYoiPs4u/w27FyztsZQ7osRLjSZbFCb0ThnI/Qa4kBiOtgSp Z8WKQeBhYRhcmrd1qRP/Ehm5maftsslK+DxYw2VbWqo+J2/icr7kTFBdBbwwE2dZBo69 FGeLYPoantAFSwUG390d4pX1VmsLGvET/L0Wt5hayeiLqe3fb8eleSYzcvfIpx42XvLN 96byzhwa/dk1Gmtizjh1675zMgtbHVepD5AROD0sjkx9e7PdJ3Xg80jQzGeB4WSFJqMM EpHQ== X-Gm-Message-State: ALoCoQncfa7boqLrQoKTr26Q6zBo33BFBKYob3Ll9bztPIVslILWugHq6qgEKueIWIRQx23gxQCL X-Received: by 10.112.64.171 with SMTP id p11mr1307077lbs.12.1422480540989; Wed, 28 Jan 2015 13:29:00 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.175 with SMTP id p15ls189232lal.58.gmail; Wed, 28 Jan 2015 13:29:00 -0800 (PST) X-Received: by 10.152.44.193 with SMTP id g1mr10749616lam.15.1422480540842; Wed, 28 Jan 2015 13:29:00 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id zm10si5553027lbb.137.2015.01.28.13.29.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Jan 2015 13:29:00 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id l4so21604545lbv.13 for ; Wed, 28 Jan 2015 13:29:00 -0800 (PST) X-Received: by 10.112.170.36 with SMTP id aj4mr10798446lbc.3.1422480540755; Wed, 28 Jan 2015 13:29:00 -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.35.133 with SMTP id h5csp1568990lbj; Wed, 28 Jan 2015 13:29:00 -0800 (PST) X-Received: by 10.224.79.82 with SMTP id o18mr859496qak.3.1422480538298; Wed, 28 Jan 2015 13:28:58 -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 k61si7705469qgf.32.2015.01.28.13.28.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 28 Jan 2015 13:28:58 -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 1YGaAQ-0005Ju-5W; Wed, 28 Jan 2015 21:28:54 +0000 Received: from mail-oi0-f42.google.com ([209.85.218.42]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YGaAK-0005Jp-9g for lng-odp@lists.linaro.org; Wed, 28 Jan 2015 21:28:48 +0000 Received: by mail-oi0-f42.google.com with SMTP id i138so20299036oig.1 for ; Wed, 28 Jan 2015 13:28:43 -0800 (PST) X-Received: by 10.60.178.105 with SMTP id cx9mr3611675oec.16.1422480522972; Wed, 28 Jan 2015 13:28:42 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id d6sm2834488obh.4.2015.01.28.13.28.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jan 2015 13:28:42 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 28 Jan 2015 15:28:35 -0600 Message-Id: <1422480515-3344-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCHv3] api: packet: odp_packet_flags: improve function names 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: bill.fischofer@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.182 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 Rename odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() for consistency with related packet APIs. Signed-off-by: Bill Fischofer Reviewed-by: Mike Holmes --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c | 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++---------- platform/linux-generic/odp_packet_flags.c | 9 +-------- test/validation/buffer/odp_packet_test.c | 5 +---- test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i < len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i < len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern "C" { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)->error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)->error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index c1b28ab..022f9a3 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -435,10 +435,7 @@ static void packet_error_flags(void) * properly set. Just check that function return one of allowed values. * @todo: check classified packet when classifier is added in place. */ - err = odp_packet_error(pkt); - CU_ASSERT(err == 0 || err == 1); - - err = odp_packet_errflag_frame_len(pkt); + err = odp_packet_has_error(pkt); CU_ASSERT(err == 0 || err == 1); } diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 0985771..03b14f9 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -342,7 +342,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, if (rx_pkt == ODP_PACKET_INVALID) break; CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id); - CU_ASSERT(odp_packet_error(rx_pkt) == 0); + CU_ASSERT(odp_packet_has_error(rx_pkt) == 0); odp_packet_free(rx_pkt); }