From patchwork Wed Aug 26 15:49:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52732 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id D62F322E9E for ; Wed, 26 Aug 2015 15:50:21 +0000 (UTC) Received: by lbcue2 with SMTP id ue2sf63539408lbc.1 for ; Wed, 26 Aug 2015 08:50: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: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=CExCmJKFuSAcYmjPWWbYKTABle1fEYjDBZ7pGrV7kt8=; b=hzjeaC8h8maiTjSvafNakPqjuR3zzYiie2TV6UYQSsXoMm+b58gsI0u//gqAplobI+ fEjOSJhvvkE3cPQBnC0Vrf5uxjOZhqO1nRU1CAO4NpUmdochZgv3mhvm+O4GCw3Bmu44 irLxhE5ldfzDgAM3zYMnG4KNQ92aOrLg/T5/uNfRmD+ibKPsAkUBtVcRFMvm3GIVzg+n WFrd/ITIalcagzPyow8yl616FNz+Wwo9SwIDLwtjygfoPHpQd31JdH50wEWeKWER6pNl /SLnavL4LDvEmsAFf9TzI+RLYxQCzh5UQ7Sad/eY7NOU1GwzFi5t7jRQqXROvO5g8Iqw f9sQ== X-Gm-Message-State: ALoCoQlIbbUXEW+iPy0W9Crf8MEWWXLUtawVf/rbzsKHXZrXq0mkXBjjNUwWBp678aup0PVyoZ2q X-Received: by 10.152.5.164 with SMTP id t4mr9887285lat.0.1440604220858; Wed, 26 Aug 2015 08:50:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.171 with SMTP id dl11ls704725lad.28.gmail; Wed, 26 Aug 2015 08:50:20 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr32083840laf.32.1440604220695; Wed, 26 Aug 2015 08:50:20 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id yn10si19051686lbb.85.2015.08.26.08.50.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 08:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labia3 with SMTP id ia3so57831803lab.3 for ; Wed, 26 Aug 2015 08:50:20 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr31026384lbc.112.1440604220260; Wed, 26 Aug 2015 08:50: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.162.200 with SMTP id yc8csp4009721lbb; Wed, 26 Aug 2015 08:50:19 -0700 (PDT) X-Received: by 10.55.40.18 with SMTP id o18mr71781103qkh.41.1440604219094; Wed, 26 Aug 2015 08:50:19 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i30si21464627qkh.117.2015.08.26.08.50.18; Wed, 26 Aug 2015 08:50:19 -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 4191E61B6C; Wed, 26 Aug 2015 15:50:18 +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 6322262077; Wed, 26 Aug 2015 15:49: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 383516207B; Wed, 26 Aug 2015 15:49:17 +0000 (UTC) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) by lists.linaro.org (Postfix) with ESMTPS id 2F4D162034 for ; Wed, 26 Aug 2015 15:49:15 +0000 (UTC) Received: by lbbpu9 with SMTP id pu9so122666124lbb.3 for ; Wed, 26 Aug 2015 08:49:14 -0700 (PDT) X-Received: by 10.152.25.166 with SMTP id d6mr30260524lag.79.1440604153850; Wed, 26 Aug 2015 08:49:13 -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 w3sm6870916lag.13.2015.08.26.08.49.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Aug 2015 08:49:13 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 26 Aug 2015 18:49:01 +0300 Message-Id: <1440604147-24703-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440604147-24703-1-git-send-email-maxim.uvarov@linaro.org> References: <1440604147-24703-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv5 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.215.49 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 6ad3308..a21c683 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;