From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZN4vn-00086c-L1 for mharc-grub-devel@gnu.org; Wed, 05 Aug 2015 16:04:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN4vl-00085x-2h for grub-devel@gnu.org; Wed, 05 Aug 2015 16:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN4vf-0005uX-0s for grub-devel@gnu.org; Wed, 05 Aug 2015 16:04:53 -0400 Received: from mail-lb0-x22e.google.com ([2a00:1450:4010:c04::22e]:35066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN4ve-0005tM-Oq for grub-devel@gnu.org; Wed, 05 Aug 2015 16:04:46 -0400 Received: by lbbpo9 with SMTP id po9so31033492lbb.2 for ; Wed, 05 Aug 2015 13:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=FWbcQxLSwjek9tAWV6qKuzBkyuET/M+4rb0U5TGbhwg=; b=fcIfr2Dq1fO0+hdr3j1LC1mOLS0TUGHSbLp7qRkZs6nj0nfxV8NSQV1To+v3jepVPw o+JQG8KWfcCjxiNpD4LZ6NTU9rBKRXW8Lq+eZwqMZvtjPkMPCvx3FgZdt9RzJmCnkhcn wKxg+wvS7hW/VqaTkw9YxbgDpf6hJcu5P744kd0kv0fJHJ/siy3o9H5P79MBz6p3naQl Y0yQ2cizlJthEAaDPJQiZS9wLe0QaBn7uPd29KG4agwVQF0i0M6mTp5/6orzNSaPUvTL jxhcrfKIlD3imrmCMARvzACkaVtBkMiUh/EboYIncxL1MHHIEG2vgFfarjG/1CC9oAlA I5PQ== X-Received: by 10.112.105.104 with SMTP id gl8mr11032848lbb.81.1438805085434; Wed, 05 Aug 2015 13:04:45 -0700 (PDT) Received: from opensuse.site (ppp91-76-6-204.pppoe.mtu-net.ru. [91.76.6.204]) by smtp.gmail.com with ESMTPSA id tj8sm784855lbb.22.2015.08.05.13.04.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 13:04:44 -0700 (PDT) Date: Wed, 5 Aug 2015 23:04:42 +0300 From: Andrei Borzenkov To: Josef Bacik Subject: Re: [PATCH 1/3] efinet: handle get_status() properly Message-ID: <20150805230442.1bf65b2d@opensuse.site> In-Reply-To: <1438799799-32097-1-git-send-email-jbacik@fb.com> References: <1438799799-32097-1-git-send-email-jbacik@fb.com> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.28; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22e Cc: grub-devel@gnu.org, mchang@suse.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2015 20:04:54 -0000 =D0=92 Wed, 5 Aug 2015 14:36:37 -0400 Josef Bacik =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > The EFI SNP documentation isn't super clear on the value that is returned= in > txbuf when calling into GetStatus. The documentation says its the pointe= r to > the recycle buffer, but the documentation for Transmit() says that it sho= uld be > the pointer to the buffer that we transmitted. Actually it says "Recycled transmit buffer address" and further "GetStatus() until the transmitted buffer shows up in the recycled transmit buffer" so it looks reasonably clear to me. > On the boxes I'm using it's= just > a random pointer (usually 0x1). It is definitely transmitting stuff, but= the > get_status call is not returning the pointer to the txbuf we passed in. Which sounds like firmware bug. To be sure - you observe it also using current GIT master? > Lo= oking > at a few EFI implementations and other SNP drivers it seems like there is > confusion everywhere on this. So since we only transmit one buffer at a = time, > just assume that a non-NULL txbuf means that our transmit happened proper= ly. > With this patch I can now do networking on our EFI enabled boxes. Thanks, >=20 > cc: Peter Jones > Signed-off-by: Josef Bacik > --- > grub-core/net/drivers/efi/efinet.c | 13 +++---------- > 1 file changed, 3 insertions(+), 10 deletions(-) >=20 > diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/e= fi/efinet.c > index f27a117..4d3f8aa 100644 > --- a/grub-core/net/drivers/efi/efinet.c > +++ b/grub-core/net/drivers/efi/efinet.c > @@ -47,19 +47,11 @@ send_card_buffer (struct grub_net_card *dev, > if (st !=3D GRUB_EFI_SUCCESS) > return grub_error (GRUB_ERR_IO, > N_("couldn't send network packet")); > - if (txbuf =3D=3D dev->txbuf) > + if (txbuf) > { > dev->txbusy =3D 0; > break; > } > - if (txbuf) > - { > - st =3D efi_call_7 (net->transmit, net, 0, dev->last_pkt_size, > - dev->txbuf, NULL, NULL, NULL); > - if (st !=3D GRUB_EFI_SUCCESS) > - return grub_error (GRUB_ERR_IO, > - N_("couldn't send network packet")); > - } > if (limit_time < grub_get_time_ms ()) > return grub_error (GRUB_ERR_TIMEOUT, > N_("couldn't send network packet")); > @@ -84,8 +76,9 @@ send_card_buffer (struct grub_net_card *dev, > we run in the GRUB_ERR_TIMEOUT case above. > Perhaps a timeout in the FW has discarded the recycle buffer. > */ > + txbuf =3D NULL; > st =3D efi_call_3 (net->get_status, net, 0, &txbuf); > - dev->txbusy =3D !(st =3D=3D GRUB_EFI_SUCCESS && txbuf =3D=3D dev->txbu= f); > + dev->txbusy =3D !(st =3D=3D GRUB_EFI_SUCCESS && txbuf); > =20 > return GRUB_ERR_NONE; > }