From patchwork Wed Aug 26 15:49:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 52736 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 8316B22E9E for ; Wed, 26 Aug 2015 15:52:33 +0000 (UTC) Received: by lbbpd10 with SMTP id pd10sf63650390lbb.3 for ; Wed, 26 Aug 2015 08:52:32 -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=IRHmrtTzblcKPuLy355/bLbb+rXf+oM1JgwH3OJeKDU=; b=Pf3i1Tz56TVlczJrprzWfy6+DrgFdd0BlZK5E794NaGOCt2cHxzvYCVYs99VmEBGL4 joNcllbHS40mhj9XQEozZLeJ5k1c8m0w1OhDlS9w/h0fbadZboSFKU/18KPmnW9D4Alh fSwLumLvm/OVJRYC3ZdcDGFeILykxBsZ6mflv1SQZF5Tb8IzbePtvvh2xYt+lUk8rn10 3JM5qAHLN4jZTMTPyMmOYRIt9O/lcrMVI8cbU5YymJ5o5Fn7YBFSDofIIc5GPsG5f4yI hGpV+ULvfYrRB/u/mY6l26RcHSnqcLJ5g4y2MjO6oCtCZQ3OePYMUK9J1ETpQ0shO88P c1xg== X-Gm-Message-State: ALoCoQnoZMr5q0LBAP4WlcVYgaiZeZXilQ6BWTzxe/00l1ePIXY/0986pYLTfq0omQ+E2W4ke5ZT X-Received: by 10.180.83.226 with SMTP id t2mr2701538wiy.5.1440604352508; Wed, 26 Aug 2015 08:52:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.138 with SMTP id s10ls468076las.25.gmail; Wed, 26 Aug 2015 08:52:32 -0700 (PDT) X-Received: by 10.152.36.41 with SMTP id n9mr31399492laj.65.1440604352177; Wed, 26 Aug 2015 08:52:32 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id da2si16940730lad.130.2015.08.26.08.52.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 08:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbpu9 with SMTP id pu9so122729362lbb.3 for ; Wed, 26 Aug 2015 08:52:32 -0700 (PDT) X-Received: by 10.112.235.130 with SMTP id um2mr31162451lbc.72.1440604351970; Wed, 26 Aug 2015 08:52:31 -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 yc8csp4010990lbb; Wed, 26 Aug 2015 08:52:30 -0700 (PDT) X-Received: by 10.107.164.103 with SMTP id n100mr4436164ioe.123.1440604349804; Wed, 26 Aug 2015 08:52:29 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l12si12405107iod.141.2015.08.26.08.52.28; Wed, 26 Aug 2015 08:52:29 -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 B76146207C; Wed, 26 Aug 2015 15:52:28 +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 DAB616208C; Wed, 26 Aug 2015 15:49:54 +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 E641262082; Wed, 26 Aug 2015 15:49:31 +0000 (UTC) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id D2A1C62075 for ; Wed, 26 Aug 2015 15:49:18 +0000 (UTC) Received: by labns7 with SMTP id ns7so4701556lab.0 for ; Wed, 26 Aug 2015 08:49:17 -0700 (PDT) X-Received: by 10.152.184.72 with SMTP id es8mr20881647lac.48.1440604157790; Wed, 26 Aug 2015 08:49:17 -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.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Aug 2015 08:49:17 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 26 Aug 2015 18:49:05 +0300 Message-Id: <1440604147-24703-6-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 5/7] linux-generic: socket: 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.182 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.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 45040fd..43c5f67 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -234,6 +234,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev, goto error; } + pktio_entry->s.state = STATE_START; return 0; error: @@ -296,6 +297,11 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int recv_msgs; int i; + if (pktio_entry->s.state == STATE_STOP) { + __odp_errno = EPERM; + return -1; + } + if (odp_unlikely(len > ODP_PACKET_SOCKET_MAX_BURST_RX)) return -1; @@ -377,6 +383,11 @@ static int sock_mmsg_send(pktio_entry_t *pktio_entry, unsigned sent_msgs = 0; unsigned flags; + if (pktio_entry->s.state == STATE_STOP) { + __odp_errno = EPERM; + return -1; + } + if (odp_unlikely(len > ODP_PACKET_SOCKET_MAX_BURST_TX)) return -1; @@ -439,11 +450,25 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry) pktio_entry->s.name); } +static int sock_start(pktio_entry_t *pktio_entry) +{ + pktio_entry->s.state = STATE_START; + return 0; +} + +static int sock_stop(pktio_entry_t *pktio_entry) +{ + pktio_entry->s.state = STATE_STOP; + return 0; +} + const pktio_if_ops_t sock_mmsg_pktio_ops = { .init = NULL, .term = NULL, .open = sock_mmsg_open, .close = sock_close, + .start = sock_start, + .stop = sock_stop, .recv = sock_mmsg_recv, .send = sock_mmsg_send, .mtu_get = sock_mtu_get,