From patchwork Thu Aug 13 11:45: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: 52384 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 72E3B2031F for ; Thu, 13 Aug 2015 11:47:49 +0000 (UTC) Received: by wicul11 with SMTP id ul11sf16274504wic.1 for ; Thu, 13 Aug 2015 04:47:48 -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=Ur6qIj9Qh7TSuvqqJB/t9KRw518SVElBsb060ZS9txY=; b=F14OWyPaOyCT9jPmBySyZ+sII0Wrw3285VtwHw00vit1fDY4Sx+tF9e3PH7yyN0rw8 ofspYUO2BbxcFzet0WFRKlK7W3glhisfTApDyT3Xrrjquynn5qsIBBsSLMCyPU1EP7Pt 5CCAgIwF86xrYEzUckpK58Y8zXxHlx4JDsjnEJ9Ezybsoi+45QfHbP76hgDOh+XAQ9iH TEv0xUBxAcoqPAqGdag49mNj3/r0qS8/WQbnBXxckgoSf0+dLONkVJBgXIfMDQfogI28 swPOR7XXRIMArZHszF191o3Ll1sqBvoA8W7cW8H3QTzkKCJlrZy6xfeDlKemPhXt1hVE wN4Q== X-Gm-Message-State: ALoCoQnnxmOn+aRz4PjVQtFn+yRIQcWW3uqnvd2CnFAvwDZdmZ8jeAU4ftjmrbjK4VCap3O0bdS9 X-Received: by 10.152.1.164 with SMTP id 4mr5024894lan.2.1439466468741; Thu, 13 Aug 2015 04:47:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.201 with SMTP id s9ls181787laj.40.gmail; Thu, 13 Aug 2015 04:47:48 -0700 (PDT) X-Received: by 10.152.36.7 with SMTP id m7mr35427764laj.87.1439466468451; Thu, 13 Aug 2015 04:47:48 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id i19si2026593lbh.10.2015.08.13.04.47.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 04:47:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbpu9 with SMTP id pu9so25495082lbb.3 for ; Thu, 13 Aug 2015 04:47:48 -0700 (PDT) X-Received: by 10.152.164.130 with SMTP id yq2mr27812216lab.76.1439466468308; Thu, 13 Aug 2015 04:47:48 -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 l6csp887829lba; Thu, 13 Aug 2015 04:47:47 -0700 (PDT) X-Received: by 10.55.17.214 with SMTP id 83mr67130852qkr.46.1439466466853; Thu, 13 Aug 2015 04:47:46 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e4si3318645qka.6.2015.08.13.04.47.46; Thu, 13 Aug 2015 04:47:46 -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 E9A4F61D14; Thu, 13 Aug 2015 11:47:45 +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 73D9A61D59; Thu, 13 Aug 2015 11:46:17 +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 B38E361FCB; Thu, 13 Aug 2015 11:46:13 +0000 (UTC) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by lists.linaro.org (Postfix) with ESMTPS id 7341061D5B for ; Thu, 13 Aug 2015 11:45:46 +0000 (UTC) Received: by wicja10 with SMTP id ja10so66381983wic.1 for ; Thu, 13 Aug 2015 04:45:45 -0700 (PDT) X-Received: by 10.180.21.169 with SMTP id w9mr57908662wie.73.1439466345440; Thu, 13 Aug 2015 04:45:45 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id ma4sm2972054wjb.38.2015.08.13.04.45.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Aug 2015 04:45:44 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 13 Aug 2015 14:45:31 +0300 Message-Id: <1439466334-16497-4-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 3/6] linux-generic: socket mmap: 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.217.173 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/socket_mmap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 7d42678..f9ba74e 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -486,6 +486,7 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, goto error; } + pktio_entry->s.state = STATE_START; return 0; error: @@ -497,6 +498,10 @@ static int sock_mmap_recv(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], unsigned len) { pkt_sock_mmap_t *const pkt_sock = &pktio_entry->s.pkt_sock_mmap; + + if (pktio_entry->s.state == STATE_STOP) + return 0; + return pkt_mmap_v2_rx(pkt_sock->rx_ring.sock, &pkt_sock->rx_ring, pkt_table, len, pkt_sock->pool, pkt_sock->if_mac); @@ -506,6 +511,9 @@ static int sock_mmap_send(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], unsigned len) { pkt_sock_mmap_t *const pkt_sock = &pktio_entry->s.pkt_sock_mmap; + + if (pktio_entry->s.state == STATE_STOP) + return 0; return pkt_mmap_v2_tx(pkt_sock->tx_ring.sock, &pkt_sock->tx_ring, pkt_table, len); } @@ -535,11 +543,25 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t *pktio_entry) pktio_entry->s.name); } +static int sock_mmap_start(pktio_entry_t *pktio_entry) +{ + pktio_entry->s.state = STATE_START; + return 0; +} + +static int sock_mmap_stop(pktio_entry_t *pktio_entry) +{ + pktio_entry->s.state = STATE_STOP; + return 0; +} + const pktio_if_ops_t sock_mmap_pktio_ops = { .init = NULL, .term = NULL, .open = sock_mmap_open, .close = sock_mmap_close, + .start = sock_mmap_start, + .stop = sock_mmap_stop, .recv = sock_mmap_recv, .send = sock_mmap_send, .mtu_get = sock_mmap_mtu_get,