From patchwork Thu Apr 9 15:01:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 46954 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 948FF21416 for ; Thu, 9 Apr 2015 15:01:21 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf12917341wgt.1 for ; Thu, 09 Apr 2015 08:01:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:message-id:date:from :user-agent:mime-version:to:references:in-reply-to:cc:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:content-transfer-encoding:content-type :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=aFbYHbGA5V/92txcc+jYO/CRZWxltQOpZPZnXKMcnu0=; b=TbST+iEOe7pyIpBzFVDe3azKI48QNe4qv0iEnjm7BCzeZ8I8hnicSYVPbonqdnOlWr PmAJ63Ucr3s7/sUxsJux6lNrM2PDNdL2ggMgVym9c4HPTlXgr5wmBHuG+H7rvmtDlWRK R4f2bKvM2K7GN5ZVaZqxMwAN/N7zSCSk/YtPGLbTT6P/LGqJBDXLJfmpvEjgMNFCMEWO L8oD7C2CXSRLkyTNwXpqxEtyOcuMJ0qrAO19fRqDEZy7zPPDg41wVdfRA3Yrzn5upart 1GEZPqvtDQNOviiHED/CvR69E9CT6IpyIKJnrnU95qFy5RIXe1/vDunZRSDRV9MyTT+u So3g== X-Gm-Message-State: ALoCoQn3md+MUJuquSy+Nv47g5c2dwXqpWqyusRyso1PCN+q6CY1vOrakG64NoP9yPCH22ZhlXp2 X-Received: by 10.194.161.194 with SMTP id xu2mr6039176wjb.1.1428591680900; Thu, 09 Apr 2015 08:01:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.70 with SMTP id le6ls334221lac.50.gmail; Thu, 09 Apr 2015 08:01:20 -0700 (PDT) X-Received: by 10.152.205.106 with SMTP id lf10mr5018797lac.89.1428591680732; Thu, 09 Apr 2015 08:01:20 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id un5si11660784lbc.53.2015.04.09.08.01.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:01:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by labbd9 with SMTP id bd9so80246934lab.2 for ; Thu, 09 Apr 2015 08:01:20 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr28003105lbb.41.1428591680589; Thu, 09 Apr 2015 08:01:20 -0700 (PDT) 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.67.65 with SMTP id l1csp524326lbt; Thu, 9 Apr 2015 08:01:19 -0700 (PDT) X-Received: by 10.140.97.98 with SMTP id l89mr34822372qge.92.1428591678979; Thu, 09 Apr 2015 08:01:18 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 2si14579626qkv.125.2015.04.09.08.01.13; Thu, 09 Apr 2015 08:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id CC5D764F6B; Thu, 9 Apr 2015 15:01:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B9D1964E5D; Thu, 9 Apr 2015 15:01:10 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2CDCA64ED0; Thu, 9 Apr 2015 15:01:09 +0000 (UTC) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by lists.linaro.org (Postfix) with ESMTPS id 66F8664E5D for ; Thu, 9 Apr 2015 15:01:08 +0000 (UTC) Received: by widdi4 with SMTP id di4so95663771wid.0 for ; Thu, 09 Apr 2015 08:01:07 -0700 (PDT) X-Received: by 10.180.101.225 with SMTP id fj1mr7016870wib.56.1428591667591; Thu, 09 Apr 2015 08:01:07 -0700 (PDT) Received: from [192.168.0.101] ([90.152.119.35]) by mx.google.com with ESMTPSA id cf12sm20481688wjb.10.2015.04.09.08.01.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:01:06 -0700 (PDT) Message-ID: <55269432.5090609@linaro.org> Date: Thu, 09 Apr 2015 16:01:06 +0100 From: Zoltan Kiss User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Bill Fischofer , Mike Holmes References: <55255B22.7000606@linaro.org> In-Reply-To: Cc: lng-odp Subject: Re: [lng-odp] odp_packet_has_error return value X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zoltan.kiss@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.215.54 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 We can say then: * @retval non-zero packet has errors, implementation can optionally return a non-zero error code, STRICTLY FOR DEBUGGING PURPOSES I think that would clarify that you shouldn't use this non-zero value to anything else than saving it into your logs. But any ideas to make it more clear are welcome. I came accross this when I found that all my DPDK packets are dropped due to an error. Currently I have this hack in place to get the error value in if there is anything wrong: I think it would be useful for an app developer to have the chance to see the underlying error code. Otherwise hacks like mine above would born. Zoli On 08/04/15 18:18, Bill Fischofer wrote: > The only problem with documenting the return as !0 is that that syntax > is ambiguous. The C expression !0 evaluates to a specific value, but > we're saying that any non-zero value is regarded as true, which is why > it is documented as such. > > On Wed, Apr 8, 2015 at 12:12 PM, Mike Holmes > wrote: > > > > On 8 April 2015 at 13:10, Bill Fischofer > wrote: > > These are booleans. However we decided that ODP considers any > non-zero value to be "true", hence the doc change. The > linux-generic implementation always returns 1 for true and since > 1 is a non-zero value that's completely conforming. > > > Agree - it is the optional addition info aspect of !0 I thought > might be an issue, if two states are returned I have no qualms about > portability > > > On Wed, Apr 8, 2015 at 12:07 PM, Mike Holmes > > wrote: > > > > On 8 April 2015 at 12:45, Zoltan Kiss > > wrote: > > Hi, > > Now it looks like: > > * @retval 1 packet has errors > * @retval 0 packet has no errors > > I found it is better for debugging if it actually > returns some error code. How about changing it to: > > * @retval 0 packet has no errors > * @retval !0 packet has errors, implementation can > optionally return an error code > > > This looks like it was intended to be a boolean test so > extra info might be misleading, and to be a standard people > can rely on optional is never a good thing. > > Is there a minimum set of errors this api can be said will > return an error code for ? If there is no standard set at > all I question having anything optional becasue the api will > have no portability at all. > > Taken from the hdr in question it looks like it would be > this list > > struct { > /* Bitfield flags for each detected error */ > uint32_t app_error:1; /**< Error bit for application use */ > uint32_t frame_len:1; /**< Frame length error */ > uint32_t snap_len:1; /**< Snap length error */ > uint32_t l2_chksum:1; /**< L2 checksum error, checks TBD */ > uint32_t ip_err:1; /**< IP error, checks TBD */ > uint32_t tcp_err:1; /**< TCP error, checks TBD */ > uint32_t udp_err:1; /**< UDP error, checks TBD */ > }; > } error_flags_t; > > > > Zoli > _________________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/__mailman/listinfo/lng-odp > > > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org ***│ *Open source > software for ARM SoCs > > __ > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp > > > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org ***│ *Open source software for > ARM SoCs > > __ > > > diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index ab3d12f..439255a 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -10,7 +10,7 @@ int odp_packet_has_error(odp_packet_t pkt) { - return (odp_packet_hdr(pkt)->error_flags.all != 0); + return (odp_packet_hdr(pkt)->error_flags.all); } /* Get Input Flags */