From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by dpdk.org (Postfix) with ESMTP id E710A378B for ; Mon, 10 Sep 2018 10:25:14 +0200 (CEST) Received: by mail-yb1-f194.google.com with SMTP id t10-v6so7630103ybb.1 for ; Mon, 10 Sep 2018 01:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y2op1Zo+ab3Kurflbb/+3/fSM1H9WxY5AAsg0QaKLpA=; b=Jxm7Gy13BcWD4FkCeBQ8eHMdACGViN/iHbjNnamlqD+Z0OPCwBAavHg1xjXw+al6AD aRZH2BKbyQW6f/OyavcJYOJkCGoS8R0KK3QCbsl3hg51WNSU5SmKjDFcjIh/BYU1lRyL m8dM0cgKDc7i+oMTRsC8m5a1qjc4JcVZvzkw+PFvyyH9SjCYwTx5F9/9EfKwONVnhL0Y p/7lXRUKvbfxVENIhlk5PKizj+ku7iWksIOoKrj9/SOasud0VrjpT7OZOCo5UTrENcre 2K9twdXYgSEd+9Txdw6a6/tF5NO7/Dc1kvUfgOOxi82D/8xTrW6tX42cH3EkOGwL9Ff3 48QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=y2op1Zo+ab3Kurflbb/+3/fSM1H9WxY5AAsg0QaKLpA=; b=JpVUkq75onILeIr2Uny5mqtr7eN3Xy3BxEFmfSyKrhWB6AL9Aqawc6qGpsBCj9G1Q5 m9aBzFOpnlefN6GzqDQOOk13sJRHQ54IfPjrXjqWRNFp/2/cZICzolg0QIHHSbOvF9os BrkfvGAnsxABfPHLdEgJI1pfi66xszfTl8OO+LGtqbZkSK5iUAi2WYpg5ejq/ortW3I5 Se6ZmdZRMsdJ5VgC4PTJBYE18MBtXAqCJeRw1kryOWD/t+jOACqg7cDJdRz5b7B3ecsp S+bSprzhfbmoZYI0HUxDa4UwEFIU270F1jWE8rhnavTOaPc6D3vhVpAqXHUOcej/fXHv XJFw== X-Gm-Message-State: APzg51C+8y8uY0ZzZkmnSsmuPjF1TyphX1yTW7gRc+zLp8QKWOJGq9ZP m/LxVeJ40F0a4eTY2IPUQuUv+MNMml2dDHxgAGZRgg== X-Google-Smtp-Source: ANB0Vda4ISMbXmqJph3tEdKeA3cfWU9gUrnfgKZwip1pT1ZNwXgfAzHwliJiFrfXbSmmcjy3DZ5lWwUAFha0IsbLfI0= X-Received: by 2002:a25:ce91:: with SMTP id x139-v6mr8853943ybe.301.1536567914108; Mon, 10 Sep 2018 01:25:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:4bc3:0:0:0:0:0 with HTTP; Mon, 10 Sep 2018 01:24:53 -0700 (PDT) In-Reply-To: <86b2ae63-f193-03ce-457d-387b785fb884@solarflare.com> References: <20180910054547.18494-1-david.marchand@6wind.com> <20180910054547.18494-3-david.marchand@6wind.com> <86b2ae63-f193-03ce-457d-387b785fb884@solarflare.com> From: David Marchand Date: Mon, 10 Sep 2018 10:24:53 +0200 Message-ID: To: Andrew Rybchenko , Olivier Matz Cc: dev@dpdk.org, "Lu, Wenzhuo" , "Wu, Jingjing" , "Iremonger, Bernard" Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 2/3] mbuf: add a non fatal sanity check helper 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: Mon, 10 Sep 2018 08:25:15 -0000 On Mon, Sep 10, 2018 at 10:12 AM, Andrew Rybchenko wrote: > +/** > + * Sanity checks on a mbuf. > + * > + * Almost like rte_mbuf_sanity_check(), but this function gives the reason > + * if corruption is detected rather than panic. > + * > + * @param m > + * The mbuf to be checked. > + * @param is_header > + * True if the mbuf is a packet header, false if it is a sub-segment > + * of a packet (in this case, some fields like nb_segs are not checked) > + * @param reason > + * A reference to a string pointer where to store the reason why a mbuf > is > + * considered invalid. > + * @return > + * - 0 if no issue has been found, reason is left untouched. > + * - -1 if a problem is detected, reason then points to a string > describing > + * the reason why the mbuf is deemed invalid. > + */ > +__rte_experimental > +int rte_mbuf_check(const struct rte_mbuf *m, int is_header, > + const char **reason); > + > > > May be it would be better to return reason as return value and if it is NULL > everything is OK? This was what I had done with my first attempt. But given the name "rte_mbuf_check", having a int (used as a bool) returned makes sense to me. So no strong opinion here. -- David Marchand