From patchwork Thu Apr 7 21:21:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 65340 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp309970lbl; Thu, 7 Apr 2016 14:22:35 -0700 (PDT) X-Received: by 10.107.31.129 with SMTP id f123mr5672631iof.180.1460064155594; Thu, 07 Apr 2016 14:22:35 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 9si1348234igz.17.2016.04.07.14.22.35; Thu, 07 Apr 2016 14:22:35 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0FCC16156E; Thu, 7 Apr 2016 21:22:35 +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 483CE61835; Thu, 7 Apr 2016 21:22:07 +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 754EF6170E; Thu, 7 Apr 2016 21:22:05 +0000 (UTC) Received: from mail-ob0-f169.google.com (mail-ob0-f169.google.com [209.85.214.169]) by lists.linaro.org (Postfix) with ESMTPS id 5D6DF6174E for ; Thu, 7 Apr 2016 21:22:04 +0000 (UTC) Received: by mail-ob0-f169.google.com with SMTP id fp4so61203401obb.2 for ; Thu, 07 Apr 2016 14:22:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ORCz3lbwcwkcJP5rFUrH4lHqrHsAHVUZerLgwbaAb54=; b=BJd5KUxXhuhor1aQ8A+jvUjXJ738r0lzGNOUwHJU4zhCLnsz5p0KcEHhbQRowbuu1/ SAznWMDNbXeUK16leOSgih5JrU7Tj+tpQo9KwlDOH0nF4CuwBS9DLhLHLyOcOV1f6kvz ndPjkmVhj4IZ1OEpLMTuVciKiJxZkOzC2WuIPSAL1mopgE7h6DL6y39m89jrdP8BYATn +l+q/XOoqT6/bXGAdrlU5iPgE79e4til0+9YFJ1R2mQqN3wvwlFeKFgk29iQ4oIdKRNu JHxcSFGBLf3sfSutGTzMLv4wE+sUzfib33KwBS0SO5r4NOjWqRFqBFdcDIw/gxB4+GMp DYuA== X-Gm-Message-State: AD7BkJITdISZFq7VIYjEEDqAuefyR+t00hRolCsNYh2pHNVbkL9SMNWBOF8vq+v6ybEKIIQbhoU= X-Received: by 10.182.109.2 with SMTP id ho2mr2697893obb.9.1460064123933; Thu, 07 Apr 2016 14:22:03 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id s1sm3096649obt.26.2016.04.07.14.22.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Apr 2016 14:22:03 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 7 Apr 2016 16:21:58 -0500 Message-Id: <1460064119-21282-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460064119-21282-1-git-send-email-bill.fischofer@linaro.org> References: <1460064119-21282-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 2/3] linux-generic: pktio: implement pktio support for user contexts X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Signed-off-by: Bill Fischofer --- .../linux-generic/include/odp_packet_io_internal.h | 1 + platform/linux-generic/odp_packet_io.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 8e1d04f..1521724 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -141,6 +141,7 @@ struct pktio_entry { odp_pool_t pool; odp_pktio_param_t param; + void *context; /**< user context pointer */ /* Storage for queue handles * Multi-queue support is pktio driver specific */ diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 1dff7a3..0d591c0 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -920,6 +920,28 @@ int odp_pktio_info(odp_pktio_t id, odp_pktio_info_t *info) return 0; } +void *odp_pktio_context(odp_pktio_t pktio) +{ + pktio_entry_t *entry = get_pktio_entry(pktio); + + if (entry) + return entry->s.context; + + return NULL; +} + +int odp_pktio_context_set(odp_pktio_t pktio, void *context) +{ + pktio_entry_t *entry = get_pktio_entry(pktio); + + if (entry) { + entry->s.context = context; + return 0; + } + + return -1; +} + void odp_pktio_print(odp_pktio_t id) { pktio_entry_t *entry;