From patchwork Wed Aug 19 13:18:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52551 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 D8BE822DB1 for ; Wed, 19 Aug 2015 13:23:25 +0000 (UTC) Received: by labth1 with SMTP id th1sf1598059lab.2 for ; Wed, 19 Aug 2015 06:23: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=j4xcHuPestaSZOZ1ykcWHqXfcMHzuSi/RP6Y4dCir2GlPWCS2DxfqYzbkUX26V233W Gbve5bTMlO9re30tIoQz3DiB+SRdbJSoQFPI9AtRvkuZIEcYMTQin4KdRgyN9kKnjj4O sXnLa4vaGeQnXUCjSiXhEmHLo0Obiy6MA4X1sNNSA3u7Rb+RUqMsK+AQeqZZibBrk7Df PcxM613tGPZMyJEeMU6Ri5pBmW8x8WQWA0XfqTX7tEbgH9C+lAVg1nre1WVogzP3eftu 3DK8dfAlpITL8Bhqy3lJ3GFwq6LD0HYN88HpSOj4LQhaqf48bp82fb68j39jhucG10S6 MvFA== X-Gm-Message-State: ALoCoQlgKcOCgKRmyzuYY/8wyjqzds8r2qGs1IpmaGy7gAzHhuhqdBmadLTjCOkYFfHMC5C7Xl4w X-Received: by 10.194.80.69 with SMTP id p5mr3249676wjx.2.1439990604826; Wed, 19 Aug 2015 06:23:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.39 with SMTP id b7ls25223lae.85.gmail; Wed, 19 Aug 2015 06:23:24 -0700 (PDT) X-Received: by 10.112.145.201 with SMTP id sw9mr11307926lbb.25.1439990604535; Wed, 19 Aug 2015 06:23:24 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id br8si496775lbb.117.2015.08.19.06.23.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Aug 2015 06:23:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbpu9 with SMTP id pu9so3080155lbb.3 for ; Wed, 19 Aug 2015 06:23:24 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr11409768lbb.35.1439990604437; Wed, 19 Aug 2015 06:23: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 yc8csp372322lbb; Wed, 19 Aug 2015 06:23:23 -0700 (PDT) X-Received: by 10.50.62.243 with SMTP id b19mr1576320igs.88.1439990603377; Wed, 19 Aug 2015 06:23:23 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i11si636121ioe.12.2015.08.19.06.23.20; Wed, 19 Aug 2015 06:23:23 -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 451F261DC7; Wed, 19 Aug 2015 13:23:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 85B146200F; Wed, 19 Aug 2015 13:20:01 +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 0BDBB61F71; Wed, 19 Aug 2015 13:19:49 +0000 (UTC) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by lists.linaro.org (Postfix) with ESMTPS id 39DC061EF2 for ; Wed, 19 Aug 2015 13:19:18 +0000 (UTC) Received: by wicja10 with SMTP id ja10so120039190wic.1 for ; Wed, 19 Aug 2015 06:19:17 -0700 (PDT) X-Received: by 10.180.21.175 with SMTP id w15mr3161452wie.58.1439990357467; Wed, 19 Aug 2015 06:19:17 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id h9sm1039322wjx.20.2015.08.19.06.19.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Aug 2015 06:19:16 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 19 Aug 2015 16:18:55 +0300 Message-Id: <1439990341-12037-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439990341-12037-1-git-send-email-maxim.uvarov@linaro.org> References: <1439990341-12037-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 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.169 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;