From patchwork Thu Aug 13 11:45:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52382 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id B001D2031F for ; Thu, 13 Aug 2015 11:46:23 +0000 (UTC) Received: by lagz9 with SMTP id z9sf15966630lag.3 for ; Thu, 13 Aug 2015 04:46:22 -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=Td5YREiHoaVcxJBVKej/C/AtGelhqa0TfxQeysd30Lm01JZCgz7B8TL1tr4w7rbyYf aXHscisRnDVOZCVXVM5vt1SM0k1fPcWkn0DwJLY7aQRP38JBgPt6ufIhaeTLnvb4BIkW /XOh+I5huzoKevjHs0Mfn5E9SjKBseKHfZjQI7iGy+NWt/3Vz/t43YrnOMuSYtNd4xye iliQAd37M/txrEHpSQEKjMexndjl4COuBPzYcbounq3BlmCYMerVqKdIFXtJ9Omz/sz5 s+k9dOZ7GeppOVYA8WeF+du6wk1djb4F90kAfA+xpyyL866A0sLIhh3im55nX/QFycBk S27w== X-Gm-Message-State: ALoCoQnTv5cNSv34F+3s99cggIHnIVx2zuk9pILIWrcQeAMSqRwR2uf+e9jREnEljFVVMCzbhb+/ X-Received: by 10.112.13.200 with SMTP id j8mr11177108lbc.14.1439466382708; Thu, 13 Aug 2015 04:46:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.198 with SMTP id 6ls190407law.79.gmail; Thu, 13 Aug 2015 04:46:22 -0700 (PDT) X-Received: by 10.152.20.4 with SMTP id j4mr13444170lae.7.1439466382556; Thu, 13 Aug 2015 04:46:22 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id z9si1996968lbu.81.2015.08.13.04.46.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 04:46:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labd1 with SMTP id d1so24703134lab.1 for ; Thu, 13 Aug 2015 04:46:22 -0700 (PDT) X-Received: by 10.112.176.228 with SMTP id cl4mr36161255lbc.106.1439466382262; Thu, 13 Aug 2015 04:46:22 -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.7.198 with SMTP id l6csp887110lba; Thu, 13 Aug 2015 04:46:21 -0700 (PDT) X-Received: by 10.55.41.170 with SMTP id p42mr66103580qkp.73.1439466380845; Thu, 13 Aug 2015 04:46:20 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p13si3279132qkh.54.2015.08.13.04.46.19; Thu, 13 Aug 2015 04:46:20 -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 61E0261E67; Thu, 13 Aug 2015 11:46:19 +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 2BAD861D83; Thu, 13 Aug 2015 11:45:51 +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 90AB161D76; Thu, 13 Aug 2015 11:45:46 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by lists.linaro.org (Postfix) with ESMTPS id 013F261CD8 for ; Thu, 13 Aug 2015 11:45:44 +0000 (UTC) Received: by wijp15 with SMTP id p15so255077430wij.0 for ; Thu, 13 Aug 2015 04:45:43 -0700 (PDT) X-Received: by 10.194.206.65 with SMTP id lm1mr77648916wjc.117.1439466343250; Thu, 13 Aug 2015 04:45:43 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id ma4sm2972054wjb.38.2015.08.13.04.45.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Aug 2015 04:45:42 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 13 Aug 2015 14:45:29 +0300 Message-Id: <1439466334-16497-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439466334-16497-1-git-send-email-maxim.uvarov@linaro.org> References: <1439466334-16497-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 1/6] 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.43 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;