From patchwork Wed Aug 26 09:10:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52713 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 0811822E9E for ; Wed, 26 Aug 2015 09:12:26 +0000 (UTC) Received: by labth1 with SMTP id th1sf63152362lab.2 for ; Wed, 26 Aug 2015 02:12:24 -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=9E2/htWj8UN6KjJbm/qWTvUmpfcrTMV2s1iINVWVihU=; b=QU6j75qNjuufP2YnpSX/x9Fhj2IB+56GU/bPtSrSimNhitPf3NSMExYqQ2ahSwTR8S Hz/vU28s3Uy1SDIiLdZCUlyXV3SsXTxQH0w2NUsCLYbQWjv/QC0qJ7f8L4IBLl7dmn3r G2KAkMoKXvixLHOujdMd/a6LBASKbiP05XNXaCfBsjk30gNBLjpVjUoZRO6ZxmXZPYQs VUP7HPc56qTmWdSwDIXLON/4b81UrZowNutY606r5AuRybm7LY2BgXXOc7gEtZnR59Yb ToRqt+VY3gewAUXx5dpg999GhdewtlO3JHfiM8vzdV4mIlubwNOpvYpGDvWOtmrwVfri RaEw== X-Gm-Message-State: ALoCoQkJXd2Jf98ckRdl8sxZn2/JMI7N4Cyy2bK0LrTyQpw4EfhqjKJrRRXk2wzWUR98uBhu11FU X-Received: by 10.112.89.228 with SMTP id br4mr9755064lbb.3.1440580344937; Wed, 26 Aug 2015 02:12:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.2 with SMTP id i2ls433084laf.100.gmail; Wed, 26 Aug 2015 02:12:24 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr29602319laj.19.1440580344776; Wed, 26 Aug 2015 02:12:24 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id x8si18294583lby.143.2015.08.26.02.12.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 02:12:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbcbn3 with SMTP id bn3so115642821lbc.2 for ; Wed, 26 Aug 2015 02:12:24 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr30574650laf.32.1440580344677; Wed, 26 Aug 2015 02:12:24 -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.162.200 with SMTP id yc8csp3774587lbb; Wed, 26 Aug 2015 02:12:23 -0700 (PDT) X-Received: by 10.107.166.13 with SMTP id p13mr2517616ioe.0.1440580342972; Wed, 26 Aug 2015 02:12:22 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 40si11760060iog.80.2015.08.26.02.12.22; Wed, 26 Aug 2015 02:12:22 -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 E133D61E65; Wed, 26 Aug 2015 09:12:21 +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 ECC7762043; Wed, 26 Aug 2015 09:11:15 +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 C37A262022; Wed, 26 Aug 2015 09:10:55 +0000 (UTC) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by lists.linaro.org (Postfix) with ESMTPS id 0193E61F90 for ; Wed, 26 Aug 2015 09:10:46 +0000 (UTC) Received: by laba3 with SMTP id a3so115191405lab.1 for ; Wed, 26 Aug 2015 02:10:44 -0700 (PDT) X-Received: by 10.152.6.194 with SMTP id d2mr29996581laa.93.1440580244553; Wed, 26 Aug 2015 02:10:44 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-161-180.pppoe.mtu-net.ru. [91.76.161.180]) by smtp.gmail.com with ESMTPSA id kc4sm6569409lbc.39.2015.08.26.02.10.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Aug 2015 02:10:43 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 26 Aug 2015 12:10:31 +0300 Message-Id: <1440580237-21578-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440580237-21578-1-git-send-email-maxim.uvarov@linaro.org> References: <1440580237-21578-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv4 1/7] linux-generic: add pktio_start and pktio_stop 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: maxim.uvarov@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.180 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: Maxim Uvarov --- .../linux-generic/include/odp_packet_io_internal.h | 6 ++++ platform/linux-generic/odp_packet_io.c | 34 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 5ae3718..f56d100 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -50,6 +50,10 @@ struct pktio_entry { pkt_sock_mmap_t pkt_sock_mmap; /**< using socket mmap * API for IO */ }; + enum { + STATE_START = 0, + STATE_STOP + } state; classifier_t cls; /**< classifier linked with this pktio*/ char name[IF_NAMESIZE]; /**< name of pktio provided to pktio_open() */ @@ -72,6 +76,8 @@ typedef struct pktio_if_ops { int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const char *devname, odp_pool_t pool); int (*close)(pktio_entry_t *pktio_entry); + int (*start)(pktio_entry_t *pktio_entry); + int (*stop)(pktio_entry_t *pktio_entry); int (*recv)(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], unsigned len); int (*send)(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 135e84f..532c264 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -289,6 +289,40 @@ int odp_pktio_close(odp_pktio_t id) return 0; } +int odp_pktio_start(odp_pktio_t id) +{ + pktio_entry_t *entry; + int res = 0; + + entry = get_pktio_entry(id); + if (!entry) + return -1; + + lock_entry(entry); + if (entry->s.ops->start) + res = entry->s.ops->start(entry); + unlock_entry(entry); + + return res; +} + +int odp_pktio_stop(odp_pktio_t id) +{ + pktio_entry_t *entry; + int res = 0; + + entry = get_pktio_entry(id); + if (!entry) + return -1; + + lock_entry(entry); + if (entry->s.ops->stop) + res = entry->s.ops->stop(entry); + unlock_entry(entry); + + return res; +} + odp_pktio_t odp_pktio_lookup(const char *dev) { odp_pktio_t id = ODP_PKTIO_INVALID;