From patchwork Wed Dec 10 21:40:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 42100 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8D5626C75 for ; Wed, 10 Dec 2014 21:40:31 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf2829418wid.11 for ; Wed, 10 Dec 2014 13:40:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:message-id:importance:from:to :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:content-type :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=cH3ViIwFVbrJjHdr5ahszLRxWGUmZo9pz/sTyvz4XrE=; b=GmiUAl0y3fX8N3QMzkRWUBNypcjD+820zdcNkPADGcsWSoilZ6jlT0YTBN+4GlMGvB fwHM0th8lOz3GVpugjfPpL48qZwjMwpbQ+zwy6UynVA4d0A9tKbp82BgiJSh16qHGcNv aGcRaA5FIGFi/koBl4GFo3EAqMp+T9iib48tiiiQB+LzKnIFeIVlk/immDpkbgmquyMS zK6ah4kqkPYdr3eo2XfG1BR7EiFWcNXS4gKjKCco9QQ0tnpeIGv6ciJ1MVcUQ+RYbSW6 wHS9nDBiTnHiggrSlrWmp3C0OUEj/v+n6527UIqvajfSFXVRcgUtCBHfu0JhC6ICr25V uM1A== X-Gm-Message-State: ALoCoQlYaB+if5WNPVXnHhyCtari52IJ6f07y1SYyILzkQs2MnY25F0azW8sPi9ARJOuALXvWPWc X-Received: by 10.112.169.101 with SMTP id ad5mr1076859lbc.1.1418247631055; Wed, 10 Dec 2014 13:40:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.42 with SMTP id p10ls171663lah.98.gmail; Wed, 10 Dec 2014 13:40:30 -0800 (PST) X-Received: by 10.152.87.171 with SMTP id az11mr6105309lab.37.1418247630834; Wed, 10 Dec 2014 13:40:30 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id oc10si5903792lbb.40.2014.12.10.13.40.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 13:40:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gm9so3165436lab.26 for ; Wed, 10 Dec 2014 13:40:30 -0800 (PST) X-Received: by 10.152.234.35 with SMTP id ub3mr6369448lac.70.1418247630721; Wed, 10 Dec 2014 13:40:30 -0800 (PST) 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.142.69 with SMTP id ru5csp334043lbb; Wed, 10 Dec 2014 13:40:29 -0800 (PST) X-Received: by 10.224.15.78 with SMTP id j14mr774253qaa.0.1418247628452; Wed, 10 Dec 2014 13:40:28 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j61si6357005qgj.88.2014.12.10.13.40.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 10 Dec 2014 13:40:28 -0800 (PST) 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 1Xyozf-0001SS-CA; Wed, 10 Dec 2014 21:40:23 +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 1XyozY-0001N0-Au for lng-odp@lists.linaro.org; Wed, 10 Dec 2014 21:40:16 +0000 Received: by mail-lb0-f172.google.com with SMTP id u10so3108322lbd.31 for ; Wed, 10 Dec 2014 13:40:10 -0800 (PST) X-Received: by 10.112.17.1 with SMTP id k1mr6099176lbd.39.1418247610292; Wed, 10 Dec 2014 13:40:10 -0800 (PST) Received: from [10.194.225.142] ([83.220.238.24]) by mx.google.com with ESMTPSA id l1sm1037045lae.11.2014.12.10.13.40.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 13:40:09 -0800 (PST) Date: Thu, 11 Dec 2014 00:40:00 +0300 Message-ID: Importance: normal From: Maxim Uvarov To: Mike Holmes MIME-Version: 1.0 X-Topics: patch Cc: lng-odp Subject: Re: [lng-odp] [PATCH] fix loop 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.53 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 Skip that patch. Maxim. -------- Исходное сообщение -------- От: Mike Holmes Дата:10.12.2014 23:13 (GMT+03:00) Кому: Maxim Uvarov Копия: lng-odp Тема: Re: [lng-odp] [PATCH] fix loop Patch does not describe why the loop needed fixing, the message also does not indicate if it was an example, test or implementation change. On 8 December 2014 at 09:58, Maxim Uvarov wrote: Signed-off-by: Maxim Uvarov ---  platform/linux-generic/odp_packet_io.c | 58 ++++++++--------------------------  1 file changed, 13 insertions(+), 45 deletions(-) -- 1.8.5.1.163.gd7aced9 diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 833725e..4399ef9 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -155,33 +155,6 @@ static int free_pktio_entry(odp_pktio_t id)         return 0;  } -static int find_loop_dev(char loop[IFNAMSIZ]) -{ -       struct ifaddrs *ifap, *ifa; - -       getifaddrs(&ifap); - -       for (ifa = ifap; ifa; ifa = ifa->ifa_next) { -               if (ifa->ifa_addr && -                   ifa->ifa_addr->sa_family == AF_INET) { -                       if ((ifa->ifa_flags & (IFF_LOOPBACK | -                                             IFF_POINTOPOINT | -                                             IFF_NOARP)) || -                           (!memcmp(ifa->ifa_name, "lxcbr", 5)) || -                           (!memcmp(ifa->ifa_name, "wlan", 4)) || -                           (!memcmp(ifa->ifa_name, "veth", 4)) || -                           (!memcmp(ifa->ifa_name, "virbr", 5))) -                               continue; -                       memcpy(loop, ifa->ifa_name, IFNAMSIZ); -                       freeifaddrs(ifap); -                       return 0; -               } -       } - -       freeifaddrs(ifap); -       return -1; -} -  odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool)  {         odp_pktio_t id; @@ -203,26 +176,21 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool)          */         loop_hint = getenv("ODP_PKTIO_LOOPDEV");         if (!strcmp(dev, "loop")) { -               if (loop_hint && (strlen(loop_hint) > 0)) { -                       if (strlen(loop_hint) >= IFNAMSIZ) { -                               ODP_ERR("pktio name %s is too big, limit is %d bytes\n", -                                       loop_hint, IFNAMSIZ); -                               return ODP_PKTIO_INVALID; -                       } +               if (!loop_hint || (strlen(loop_hint) == 0)) { +                       ODP_ERR("Set loop with ODP_PKTIO_LOOPDEV=ethX\n"); +                       return ODP_PKTIO_INVALID; +               } -                       memset(loop, 0, IFNAMSIZ); -                       memcpy(loop, loop_hint, strlen(loop_hint)); -                       dev = loop; -                       ODP_DBG("pktio using %s as loopback device\n", loop_hint); -               } else { -                       if (!find_loop_dev(loop)) { -                               ODP_DBG("pktio rename loop to %s\n", loop); -                               dev = loop; -                       } else { -                               ODP_DBG("pktio: No suitable netdev.\n"); -                               return ODP_PKTIO_INVALID; -                       } +               if (strlen(loop_hint) >= IFNAMSIZ) { +                       ODP_ERR("pktio name %s is too big, limit is %d bytes\n", +                               loop_hint, IFNAMSIZ); +                       return ODP_PKTIO_INVALID;                 } + +               memset(loop, 0, IFNAMSIZ); +               memcpy(loop, loop_hint, strlen(loop_hint)); +               dev = loop; +               ODP_DBG("pktio using %s as loopback device\n", loop_hint);         }         id = alloc_lock_pktio_entry();