[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191228162002.3a603c8b@hermes.lan>
Date:   Sat, 28 Dec 2019 16:20:02 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Haiyang Zhang <haiyangz@...rosoft.com>
Cc:     sashal@...nel.org, linux-hyperv@...r.kernel.org,
        netdev@...r.kernel.org, kys@...rosoft.com, sthemmin@...rosoft.com,
        olaf@...fle.de, vkuznets@...hat.com, davem@...emloft.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next, 1/3] Drivers: hv: vmbus: Add a dev_num
 variable based on channel offer sequence
On Sat, 28 Dec 2019 15:46:31 -0800
Haiyang Zhang <haiyangz@...rosoft.com> 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?
Powered by blists - more mailing lists