Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp12599571ybl; Sat, 28 Dec 2019 16:21:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxoLrT5JNXyd2ADd5WvY98TcN4oJmzf63yLA7MT2/KMyj2EH2rEpx7dFNBqtEWkLVc3PD03 X-Received: by 2002:a05:6830:689:: with SMTP id q9mr61345933otr.285.1577578863626; Sat, 28 Dec 2019 16:21:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577578863; cv=none; d=google.com; s=arc-20160816; b=WtEQpBnlTgqH4sUyF+UAbqGbEpqJ9FmGcZuF/PgDQd/CxYxZcy5fDXMod2DYYWPUED 8H/p9MSYuJqILr0pGkgcBLxORIVx5E4gQIURnzGxNk0GX1KvOXMQTTRq2WlfOciotqVU pCtjBYWdzM7EzS/cgV0kQMcXMcNLdx2Hq1BamuUbPoh06lFSy5Ta+vadUKPGLHsq0K/o yvb4BEM5M6cxFVmkNPowIbMoM7sJcj737uo/hdDBf/7wgwAheV6Hi1ORSJMvkDN9TLtu 7bxD2pkAM4Ej5zJ0KJkN7numg0YPq/qFI6RRA08T8Fkw8LUWCHV0KYA8iibrr/h+t1IF UDrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8DnX5yqKDg1aP0+Hxr5DNL1ZfiiJOI2MJ7VQGf4X/Sc=; b=1GEdaBpDCVqBbQuiLHkeDcS+7Qyd9rgsp6fAY/LEIyTES7ThBWmMVpL2ug0BJGUOrx tEGfT1cskx20dPzDrjR9rfXpPImwPUqWcxfRqNDx+m2r/iXC2UJVbD2Mqe8gio2Ej9rR THaogN8NanX05JPUTRogosjw8RzjZ66fuU3xWMnIbqiJpfuTOD5JGc5fCC7Gd0aS/5aE KQqhhXtD9h580tlRuQC5mFa9zt1Jpn3mKp797YAfwA25uPsBx1ycTbogfNsO9wBw1AHM gljk3xDIwmFOxsD6KEGWpfHh2qSXCmT0RwwN08pfDwiSxPCbhYOhwPHtU2YroGIMBJOe 4WOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=bIi0LkPL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si18724559oij.139.2019.12.28.16.20.51; Sat, 28 Dec 2019 16:21:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=bIi0LkPL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726455AbfL2AUL (ORCPT + 99 others); Sat, 28 Dec 2019 19:20:11 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46300 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfL2AUL (ORCPT ); Sat, 28 Dec 2019 19:20:11 -0500 Received: by mail-pf1-f194.google.com with SMTP id n9so8708999pff.13 for ; Sat, 28 Dec 2019 16:20:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8DnX5yqKDg1aP0+Hxr5DNL1ZfiiJOI2MJ7VQGf4X/Sc=; b=bIi0LkPLfVweNmWGGSgvFoi3qUj6IyYvn0BuETnzJnZJnfdIAb+kUuXzRHji8eWp95 5TfVgQlrfsd6zC/qVVU8ZmdWobWniVGzcTmMC4y8pjB5hV8Uvw2FSCZ53DSCZDCk8GAE Y6cvKDJx98316m7wR10b9paYTbutq/LmsB7rd+qwqJnzJ7WQcpP399VmRrvjwstOYhio JKqJR3ch0d04akWP0N2jHIIfF7QwBunu1+5HGSQT19/L6aEdkxV3cs5YtowQymeNU5IQ 10XXKvi6mmQURxMPy/BQIC7zlNIP3xZwusjU7VOqryfXsShlvvcL9B8R3TYF3zMWWc1y 9GAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8DnX5yqKDg1aP0+Hxr5DNL1ZfiiJOI2MJ7VQGf4X/Sc=; b=WfTKfdAhMZDlboUlgiHE5Xyua4YPK4u3CzzKoQ4HGI4IN2xTsJrCxUKOP+6lZjNvx/ Ss8tBYjvB4JIrhNMLXjvSWrRvbcpgSxu3J9AJ+giqNnHWUSxgUG3vO1ZvJZhm7fw2Hsl ggoppURiEt8kqRGv1nRUePUBiiVCJj2+E7AqHkMP6XPZ+/CvwMVdeh43fWbtyyLqA2xA hkKXPBezE9hR6WeMxM9Ixajj946SkFqjoylGqrBc7an3dQh/epwzYwky2MepK+yEXqQk k66eAX1PgowWxbWCc5rodniMHyOGPk7S5ZGA9s0YCXjZ4sEcxvvcTZa4YPwRj03aY3me 61+g== X-Gm-Message-State: APjAAAVkzz57acGtms6KtXMQImHl9VGkfpBk8DxUyXGuaYYTVQ0C1Uak TeNakEXEI+aaEAuz1PCLPYOMSw== X-Received: by 2002:a65:50c6:: with SMTP id s6mr64954989pgp.365.1577578810560; Sat, 28 Dec 2019 16:20:10 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j9sm40064570pfn.152.2019.12.28.16.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2019 16:20:10 -0800 (PST) Date: Sat, 28 Dec 2019 16:20:02 -0800 From: Stephen Hemminger To: Haiyang Zhang Cc: sashal@kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, kys@microsoft.com, sthemmin@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, davem@davemloft.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next, 1/3] Drivers: hv: vmbus: Add a dev_num variable based on channel offer sequence Message-ID: <20191228162002.3a603c8b@hermes.lan> In-Reply-To: <1577576793-113222-2-git-send-email-haiyangz@microsoft.com> References: <1577576793-113222-1-git-send-email-haiyangz@microsoft.com> <1577576793-113222-2-git-send-email-haiyangz@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 28 Dec 2019 15:46:31 -0800 Haiyang Zhang wrote: > + > +next: > + found = false; > + > + list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { > + if (i == channel->dev_num && > + guid_equal(&channel->offermsg.offer.if_type, > + &newchannel->offermsg.offer.if_type)) { > + found = true; > + break; > + } > + } > + > + if (found) { > + i++; > + goto next; > + } > + Overall, keeping track of dev_num is a good solution. I prefer not having a loop coded with goto's. Why not a nested loop. Also, there already is a search of the channel list in vmbus_process_offer() so why is another lookup needed?