From patchwork Thu Oct 16 21:50:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 38834 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87DC820973 for ; Thu, 16 Oct 2014 21:51:20 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf235893wiv.0 for ; Thu, 16 Oct 2014 14:51:19 -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:message-id:date:from:user-agent :mime-version:to:references:in-reply-to:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list :content-transfer-encoding:content-type; bh=513RNbT1MTvcjUAk8HnY6V6Bb/BRQSaVjEvxKgVJlq4=; b=WMYW5z4xPgLYcuYpBr5hQ8mYeLSlzCt6TSv07mGZ0bnakjMjYNw2tEwVHfq2bgqepZ IoGtP71L50vhVGbA8HJQYj46Hg+0h/GpviPFf3mfkKTyzWsERj/3+z8FuArWjL6AuO92 6IhDQNdZmxFEvwm7aLwtptYQM9aFAvKRZtuJmDZetqm3B/KaEq9ppvi1lWJvRbe4qKXb A8fim0SGjJwLcg6flCgNJBPzn4A0xEJpGOSg68bZsk7X4+4zBPS8/cxszVKquOOAa7AR wxTfVdYPtlPXUn57fi6+FNvBRumz8eAcTzpyIH3CRjufj74raCtxwWaQgX5wYMQrGo+T ZHdA== X-Gm-Message-State: ALoCoQkr5ebi9RBAs/lzVGOzrYaH3GF5sCBFghO3nQgdeMUppl/eHEGQl6F3hUQRo5fIK96yXGKe X-Received: by 10.180.93.35 with SMTP id cr3mr1315746wib.2.1413496279669; Thu, 16 Oct 2014 14:51:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.2 with SMTP id ku2ls120032lac.2.gmail; Thu, 16 Oct 2014 14:51:19 -0700 (PDT) X-Received: by 10.112.239.12 with SMTP id vo12mr4447384lbc.81.1413496279446; Thu, 16 Oct 2014 14:51:19 -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 bk5si36565937lbb.109.2014.10.16.14.51.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Oct 2014 14:51:19 -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 mail-la0-f43.google.com with SMTP id mc6so3701790lab.2 for ; Thu, 16 Oct 2014 14:51:19 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr4593530lbb.46.1413496279348; Thu, 16 Oct 2014 14:51:19 -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.84.229 with SMTP id c5csp126036lbz; Thu, 16 Oct 2014 14:51:18 -0700 (PDT) X-Received: by 10.140.94.50 with SMTP id f47mr6214132qge.50.1413496277751; Thu, 16 Oct 2014 14:51:17 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id h90si43060888qgf.36.2014.10.16.14.51.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014 14:51:17 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xeswz-0001q9-Kg; Thu, 16 Oct 2014 21:51:13 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xesws-0001pa-H0 for lng-odp@lists.linaro.org; Thu, 16 Oct 2014 21:51:06 +0000 Received: by mail-lb0-f172.google.com with SMTP id b6so3602312lbj.3 for ; Thu, 16 Oct 2014 14:51:00 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr4423008lbc.23.1413496260236; Thu, 16 Oct 2014 14:51:00 -0700 (PDT) Received: from [192.168.1.55] (ppp91-76-163-205.pppoe.mtu-net.ru. [91.76.163.205]) by mx.google.com with ESMTPSA id wj8sm8154357lbb.34.2014.10.16.14.50.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Oct 2014 14:50:59 -0700 (PDT) Message-ID: <54403DC2.2040203@linaro.org> Date: Fri, 17 Oct 2014 01:50:58 +0400 From: Maxim Uvarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: lng-odp@lists.linaro.org References: <1410912693-31847-1-git-send-email-mike.holmes@linaro.org> In-Reply-To: <1410912693-31847-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: Re: [lng-odp] [PATCH] odp_packet_io.c: Fix unreachable code X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org 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.mail=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 Mike this patch needed update to the latest odp code. Also it will be good to split it on 2: one for indent and other to exactly problem. Just for better review. When applying I think that your fix is not quite correct. And I suggest to do it in that way: Maxim. On 09/17/2014 04:11 AM, Mike Holmes wrote: > Signed-off-by: Mike Holmes > --- > Also fixed indentation > > platform/linux-generic/odp_packet_io.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 33ade10..78d5243 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -122,7 +122,7 @@ static void init_pktio_entry(pktio_entry_t *entry, odp_pktio_params_t *params) > case ODP_PKTIO_TYPE_SOCKET_MMAP: > memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock)); > memset(&entry->s.pkt_sock_mmap, 0, > - sizeof(entry->s.pkt_sock_mmap)); > + sizeof(entry->s.pkt_sock_mmap)); > break; > #ifdef ODP_HAVE_NETMAP > case ODP_PKTIO_TYPE_NETMAP: > @@ -220,7 +220,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, > break; > case ODP_PKTIO_TYPE_SOCKET_MMAP: > res = setup_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, dev, > - pool, params->sock_params.fanout); > + pool, params->sock_params.fanout); > if (res == -1) { > close_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap); > free_pktio_entry(id); > @@ -231,7 +231,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, > case ODP_PKTIO_TYPE_NETMAP: > > res = setup_pkt_netmap(&pktio_entry->s.pkt_nm, dev, > - pool, ¶ms->nm_params); > + pool, ¶ms->nm_params); > if (res == -1) { > close_pkt_netmap(&pktio_entry->s.pkt_nm); > free_pktio_entry(id); > @@ -275,8 +275,8 @@ int odp_pktio_close(odp_pktio_t id) > break; > #endif > default: > + res |= free_pktio_entry(id); > break; > - res |= free_pktio_entry(id); > } > } > unlock_entry(entry); > @@ -310,15 +310,15 @@ int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) > switch (pktio_entry->s.params.type) { > case ODP_PKTIO_TYPE_SOCKET_BASIC: > pkts = recv_pkt_sock_basic(&pktio_entry->s.pkt_sock, > - pkt_table, len); > + pkt_table, len); > break; > case ODP_PKTIO_TYPE_SOCKET_MMSG: > pkts = recv_pkt_sock_mmsg(&pktio_entry->s.pkt_sock, > - pkt_table, len); > + pkt_table, len); > break; > case ODP_PKTIO_TYPE_SOCKET_MMAP: > pkts = recv_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, > - pkt_table, len); > + pkt_table, len); > break; > #ifdef ODP_HAVE_NETMAP > case ODP_PKTIO_TYPE_NETMAP: > @@ -352,20 +352,20 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) > switch (pktio_entry->s.params.type) { > case ODP_PKTIO_TYPE_SOCKET_BASIC: > pkts = send_pkt_sock_basic(&pktio_entry->s.pkt_sock, > - pkt_table, len); > + pkt_table, len); > break; > case ODP_PKTIO_TYPE_SOCKET_MMSG: > pkts = send_pkt_sock_mmsg(&pktio_entry->s.pkt_sock, > - pkt_table, len); > + pkt_table, len); > break; > case ODP_PKTIO_TYPE_SOCKET_MMAP: > pkts = send_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, > - pkt_table, len); > + pkt_table, len); > break; > #ifdef ODP_HAVE_NETMAP > case ODP_PKTIO_TYPE_NETMAP: > pkts = send_pkt_netmap(&pktio_entry->s.pkt_nm, > - pkt_table, len); > + pkt_table, len); > break; > #endif > default: --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -227,9 +227,11 @@ int odp_pktio_close(odp_pktio_t id) res = close_pkt_sock_mmap(&entry->s.pkt_sock_mmap); break; default: + ODP_ABORT("wrong packet i/o branch\n"); break; - res |= free_pktio_entry(id); } + /* free packet i/o entry on close */ + res |= free_pktio_entry(id); } unlock_entry(entry);