From patchwork Thu Aug 13 11:45:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52383 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 0F3382031F for ; Thu, 13 Aug 2015 11:47:17 +0000 (UTC) Received: by wicja10 with SMTP id ja10sf16245693wic.2 for ; Thu, 13 Aug 2015 04:47:16 -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=RFrJbwArTN+5Q4Yo26VEUIbEVa86rUyQP5RjNg2JTWw=; b=Zhy5PEjyi90FE9uSd5vTCqiPxPyOZPxusrm5Ip5qo84iV5RmrA0+7J6/NmEZV49ruK Kb+9E3e1WrJXeU1YKi6PaG1MPeGf3tIfabKa8ooktA+N8cq2SsCfwEMxDCsIn+nPFttl luv5vnHLDlAIul7niiwCQws4XzVZKmzI2DOaQk+g5/5OEWNzM0kHngOr+r2SkdJ09pf0 jVg5zfEl6mVyGvjVSqIIdkc8gEQ6erqNpNArc5osMWaqwhnVk40quFQjdqKTtlQkGd8Z P2tT74GbP0Fmn+m/pxh6GpHwkyBH6f+CVFod6Cs8+V1Wj6sT1LQgOBCh+SxpTYyaiPfl 2KoA== X-Gm-Message-State: ALoCoQm0vXpzOIZsKyXp1qiBxdluerppKc+7sHKlS+RNO1F6cSsTyAfwG3I5NUmqK6SrvOyxUBB3 X-Received: by 10.194.188.104 with SMTP id fz8mr11077032wjc.1.1439466436311; Thu, 13 Aug 2015 04:47:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.164 with SMTP id az4ls198593lab.81.gmail; Thu, 13 Aug 2015 04:47:16 -0700 (PDT) X-Received: by 10.112.157.36 with SMTP id wj4mr35588016lbb.115.1439466436144; Thu, 13 Aug 2015 04:47:16 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id q5si1987157laj.131.2015.08.13.04.47.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 04:47:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagz9 with SMTP id z9so24564652lag.3 for ; Thu, 13 Aug 2015 04:47:16 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr36914696lbc.32.1439466436050; Thu, 13 Aug 2015 04:47:16 -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 l6csp887574lba; Thu, 13 Aug 2015 04:47:15 -0700 (PDT) X-Received: by 10.140.93.200 with SMTP id d66mr67604160qge.62.1439466434648; Thu, 13 Aug 2015 04:47:14 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 1si3253096qkq.118.2015.08.13.04.47.13; Thu, 13 Aug 2015 04:47:14 -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 BBA1461E3C; Thu, 13 Aug 2015 11:47:13 +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 D34C761E3B; Thu, 13 Aug 2015 11:45:56 +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 B194861D83; Thu, 13 Aug 2015 11:45:50 +0000 (UTC) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by lists.linaro.org (Postfix) with ESMTPS id 3695F61D14 for ; Thu, 13 Aug 2015 11:45:45 +0000 (UTC) Received: by wibhh20 with SMTP id hh20so70131325wib.0 for ; Thu, 13 Aug 2015 04:45:44 -0700 (PDT) X-Received: by 10.194.121.34 with SMTP id lh2mr77872395wjb.101.1439466344402; Thu, 13 Aug 2015 04:45:44 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id ma4sm2972054wjb.38.2015.08.13.04.45.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Aug 2015 04:45:43 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 13 Aug 2015 14:45:30 +0300 Message-Id: <1439466334-16497-3-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 2/6] linux-generic: loop: implement 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.54 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 --- platform/linux-generic/pktio/loop.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 188a9ee..8c45e47 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -39,6 +39,7 @@ static int loopback_open(odp_pktio_t id, pktio_entry_t *pktio_entry, if (pktio_entry->s.pkt_loop.loopq == ODP_QUEUE_INVALID) return -1; + pktio_entry->s.state = STATE_START; return 0; } @@ -54,6 +55,9 @@ static int loopback_recv(pktio_entry_t *pktio_entry, odp_packet_t pkts[], odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; queue_entry_t *qentry; + if (pktio_entry->s.state == STATE_STOP) + return 0; + qentry = queue_to_qentry(pktio_entry->s.pkt_loop.loopq); nbr = queue_deq_multi(qentry, hdr_tbl, len); @@ -72,6 +76,9 @@ static int loopback_send(pktio_entry_t *pktio_entry, odp_packet_t pkt_tbl[], queue_entry_t *qentry; unsigned i; + if (pktio_entry->s.state == STATE_STOP) + return 0; + for (i = 0; i < len; ++i) hdr_tbl[i] = odp_buf_to_hdr(_odp_packet_to_buffer(pkt_tbl[i])); @@ -103,11 +110,25 @@ static int loopback_promisc_mode_get(pktio_entry_t *pktio_entry) return pktio_entry->s.pkt_loop.promisc ? 1 : 0; } +static int loopback_start(pktio_entry_t *pktio_entry) +{ + pktio_entry->s.state = STATE_START; + return 0; +} + +static int loopback_stop(pktio_entry_t *pktio_entry) +{ + pktio_entry->s.state = STATE_STOP; + return 0; +} + const pktio_if_ops_t loopback_pktio_ops = { .init = NULL, .term = NULL, .open = loopback_open, .close = loopback_close, + .start = loopback_start, + .stop = loopback_stop, .recv = loopback_recv, .send = loopback_send, .mtu_get = loopback_mtu_get,