grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [edk2] [PATCH 2/2] efinet: fix lost packets due to active MNP instan


From: Andrei Borzenkov
Subject: Re: [edk2] [PATCH 2/2] efinet: fix lost packets due to active MNP instances
Date: Thu, 7 May 2015 20:39:51 +0300

В Wed, 29 Apr 2015 15:47:44 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <address@hidden> пишет:

> On 25.04.2015 16:12, Andrei Borzenkov wrote:
> > ---
> >  grub-core/net/drivers/efi/efinet.c | 101 
> > ++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 99 insertions(+), 2 deletions(-)
> > 
> > diff --git a/grub-core/net/drivers/efi/efinet.c 
> > b/grub-core/net/drivers/efi/efinet.c
> > index f171f20..46e337a 100644
> > --- a/grub-core/net/drivers/efi/efinet.c
> > +++ b/grub-core/net/drivers/efi/efinet.c
> > @@ -142,9 +142,52 @@ get_card_packet (struct grub_net_card *dev)
> >    return nb;
> >  }
> >  
> > +static grub_err_t
> > +open_card (struct grub_net_card *dev)
> > +{
> > +  grub_efi_simple_network_t *net;
> > +
> > +  /* Try to reopen SNP exlusively to close any active MNP protocol instance
> > +     that may compete for packet polling
> > +   */
> > +  net = grub_efi_open_protocol (dev->efi_handle, &net_io_guid,
> > +                           GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
> > +  if (net)
> > +    {
> > +      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
> > +     && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
> > +   return GRUB_ERR_BAD_DEVICE;
> > +
> Please use proper grub_error.
> > +      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
> > +   return GRUB_ERR_BAD_DEVICE;
> > +
> Ditto
> > +      if (net->mode->state == GRUB_EFI_NETWORK_STARTED
> > +     && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
> > +   return GRUB_ERR_BAD_DEVICE;
> > +
> Ditto
> 
> Otherwise patch looks good. If you're comfortable with it, please
> commit. Make sure to credit all relevant authors, feel free to use
> Also-By to credit several authors (AFAIU Martin as main author and you
> in Also-By)
> 

I'm not really comfortable with it, but it has been in distributions
for quite some time so I expect it to work real life. I split it in two
patches - for filtering out extra SNP devices and actual exclusive open.

Attachment: pgp4eHsgvoj4M.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]