From patchwork Fri Sep 4 10:16:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 53081 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id BC06C2159E for ; Fri, 4 Sep 2015 10:17:53 +0000 (UTC) Received: by lamp12 with SMTP id p12sf5431186lam.2 for ; Fri, 04 Sep 2015 03:17:52 -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: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=koGF5jbIB4Go9cxi6WrGXmu6lXvj5BfFywSBUtq1YrU=; b=fTErm45f3KHJB/2cCXcO9F1ain0FKmOFApmmIpIabzmP5omHlcDLwb6uX5VZ2fnVur cV/HuA8sScUi0cD+leCi1OgG+cYUKLPBsUUpiq4h5nC/1wNCnrZ8eTMQALSZi5twPupt jFddN3viiTeMQMrFDdy+sYqOI3paXSez869yaaHl2w6ILBRmQW4N869jIaXh0wCmNhFT a8F6O7FA+TZhwxPLq5xG0NaGoitmXktbq1RnWMN5AwsIWET1nCU1ysXaFrw93Pj3jb7W 92tym8LUIi2flm6uvjOFOGvNnsLDhrHZMlBlpPL7T1vgasjPHLxujomx5bTGeSaVWbpI zndA== X-Gm-Message-State: ALoCoQkCgtCNP7ObavxsIWZKVn8bi1IozN936gCzz2OIp9ffQp9zvmo/vwdp+x+VdwtteoTFwpq2 X-Received: by 10.112.189.105 with SMTP id gh9mr830139lbc.16.1441361872687; Fri, 04 Sep 2015 03:17:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.103 with SMTP id l7ls325276laf.35.gmail; Fri, 04 Sep 2015 03:17:52 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr2844369lbc.41.1441361872397; Fri, 04 Sep 2015 03:17:52 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id dq8si1864618lbc.171.2015.09.04.03.17.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 03:17:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbpo4 with SMTP id o4so8626300lbp.2 for ; Fri, 04 Sep 2015 03:17:52 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr3009457laf.32.1441361872143; Fri, 04 Sep 2015 03:17:52 -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.164.42 with SMTP id yn10csp1851351lbb; Fri, 4 Sep 2015 03:17:51 -0700 (PDT) X-Received: by 10.140.232.135 with SMTP id d129mr4095846qhc.34.1441361871222; Fri, 04 Sep 2015 03:17:51 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 14si2264271qhx.61.2015.09.04.03.17.49; Fri, 04 Sep 2015 03:17:51 -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 87A48619F2; Fri, 4 Sep 2015 10:17:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D016D61A32; Fri, 4 Sep 2015 10:17:24 +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 10B6661A0F; Fri, 4 Sep 2015 10:17:20 +0000 (UTC) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by lists.linaro.org (Postfix) with ESMTPS id E1777619CE for ; Fri, 4 Sep 2015 10:17:18 +0000 (UTC) Received: by wicge5 with SMTP id ge5so12521097wic.0 for ; Fri, 04 Sep 2015 03:17:18 -0700 (PDT) X-Received: by 10.180.87.1 with SMTP id t1mr5628515wiz.33.1441361838130; Fri, 04 Sep 2015 03:17:18 -0700 (PDT) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id r8sm3469269wiz.2.2015.09.04.03.17.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Sep 2015 03:17:17 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Fri, 4 Sep 2015 11:16:28 +0100 Message-Id: <1441361788-2723-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1441361788-2723-1-git-send-email-stuart.haslam@linaro.org> References: <1441361788-2723-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 2/2] linux-generic: pktio: check pool type is ODP_POOL_PACKET 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stuart.haslam@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.172 as permitted sender) smtp.mailfrom=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 Signed-off-by: Stuart Haslam --- platform/linux-generic/odp_packet_io.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 4e07766..58d4764 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -248,11 +248,26 @@ static odp_pktio_t setup_pktio_entry(const char *dev, odp_pool_t pool, return id; } +static int pool_type_is_packet(odp_pool_t pool) +{ + odp_pool_info_t pool_info; + + if (pool == ODP_POOL_INVALID) + return 0; + + if (odp_pool_info(pool, &pool_info) != 0) + return 0; + + return pool_info.params.type == ODP_POOL_PACKET; +} + odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool, const odp_pktio_param_t *param) { odp_pktio_t id; + ODP_ASSERT(pool_type_is_packet(pool)); + id = odp_pktio_lookup(dev); if (id != ODP_PKTIO_INVALID) { /* interface is already open */