RE: [PATCH v3 08/12] Drivers: hv: vmbus: Ignore the offers when resuming from hibernation
From: Dexuan Cui
Date: Fri Aug 30 2019 - 20:24:39 EST
> From: Michael Kelley <mikelley@xxxxxxxxxxxxx>
> Sent: Friday, August 23, 2019 12:57 PM
>
> From: Dexuan Cui <decui@xxxxxxxxxxxxx> Sent: August 19, 2019 6:52 PM
> >
> > diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> > @@ -337,6 +337,33 @@ struct vmbus_channel *relid2channel(u32 relid)
> > }
> >
> > /*
> > + * find_primary_channel_by_offer - Get the channel object given the new
> offer.
> > + * This is only used in the resume path of hibernation.
> > + */
> > +struct vmbus_channel *
> > +find_primary_channel_by_offer(const struct vmbus_channel_offer_channel
> *offer)
> > +{
> > + struct vmbus_channel *channel;
> > + const guid_t *inst1, *inst2;
> > +
> > + WARN_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
> > +
> > + /* Ignore sub-channel offers. */
> > + if (offer->offer.sub_channel_index != 0)
> > + return NULL;
> > +
> > + list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
> > + inst1 = &channel->offermsg.offer.if_instance;
> > + inst2 = &offer->offer.if_instance;
> > +
> > + if (guid_equal(inst1, inst2))
> > + return channel;
> > + }
> > +
> > + return NULL;
> > +}
>
> Any particular reason this new function is in connection.c instead of
> putting it in channel_mgmt.c where it is called?
There is a similar function relid2channel(), which is in connection.c.
Since the new function is only used in channel_mgmt.c. I'll move it to
channel_mgmt.c in v4.
Thanks,
-- Dexuan