From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZNznU-0000iQ-5k for mharc-grub-devel@gnu.org; Sat, 08 Aug 2015 04:48:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNznR-0000gO-N1 for grub-devel@gnu.org; Sat, 08 Aug 2015 04:48:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNznM-0001St-O1 for grub-devel@gnu.org; Sat, 08 Aug 2015 04:48:05 -0400 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]:35589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNznM-0001S4-FU for grub-devel@gnu.org; Sat, 08 Aug 2015 04:48:00 -0400 Received: by lbbpo9 with SMTP id po9so72413679lbb.2 for ; Sat, 08 Aug 2015 01:47:59 -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=5Hq0xNB8S7gZFIw+W7VxnBEefo5jpgeEHIo8wYZhVPQ=; b=EWhK3bBfPw96UZWJd1kSPdqd4oLra9ZhfhqyERXNIxrMYeTyokBygR+e7d+W+NXWrn 05H2+hQKG6joOxgwSEFYelkbQJS27aGNPJ+OfXxmX/yQ5Z4jtgqhaNg038pwlUXZ1sh3 WK9XjPVoJlW2ddPZxMpsfVqriy4lXKQUO799XqCPvJVo1aufRivcMD+YU8UWqSX+bwhC Hl9ogmKhNdOft+ugvjIsETkVdwrOLs3dlGFxFqegknfvfBpXggdfkjin87isdx4zKg54 ZCYXlXmJqggcrXttAbZY0DND0BMINAgFt3YnerNuCZ4Luzp/U2L7xO0lkWLQ5HNKAw/F NdzQ== X-Received: by 10.112.50.177 with SMTP id d17mr12021463lbo.18.1439023679239; Sat, 08 Aug 2015 01:47:59 -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 pw1sm2715937lac.17.2015.08.08.01.47.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Aug 2015 01:47:57 -0700 (PDT) Date: Sat, 8 Aug 2015 11:47:55 +0300 From: Andrei Borzenkov To: Stanislav Kholmanskikh Subject: Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices Message-ID: <20150808114755.567a82b9@opensuse.site> In-Reply-To: <1437031301-28898-1-git-send-email-stanislav.kholmanskikh@oracle.com> References: <1437031301-28898-1-git-send-email-stanislav.kholmanskikh@oracle.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::234 Cc: vasily.isaenko@oracle.com, grub-devel@gnu.org, allen.pais@oracle.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: Sat, 08 Aug 2015 08:48:06 -0000 =D0=92 Thu, 16 Jul 2015 10:21:41 +0300 Stanislav Kholmanskikh =D0=BF=D0=B8=D1= =88=D0=B5=D1=82: > sun4v vnet devices do not implement the support of duplex and speed > instance attributes. An attempt to open such a device with > the attributes will fail: >=20 > ok select net:speed=3Dauto,duplex=3Dauto > Unknown key 'speed' > Unknown key 'duplex' > Manual Configuration: Host IP, boot server and filename must be specified > WARNING: /virtual-devices@100/channel-devices@200/network@0: Can't open O= BP standard TFTP package >=20 > Can't open device > ok >=20 > Therefore, let's not set SUFFIX for such devices. >=20 > Signed-off-by: Stanislav Kholmanskikh > --- > grub-core/net/drivers/ieee1275/ofnet.c | 23 +++++++++++++++++++++-- > 1 files changed, 21 insertions(+), 2 deletions(-) >=20 > diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drive= rs/ieee1275/ofnet.c > index eea8e71..dbcf337 100644 > --- a/grub-core/net/drivers/ieee1275/ofnet.c > +++ b/grub-core/net/drivers/ieee1275/ofnet.c > @@ -305,6 +305,7 @@ search_net_devices (struct grub_ieee1275_devalias *al= ias) > grub_uint64_t prop; > grub_uint8_t *pprop; > char *shortname; > + char need_suffix =3D 1; > =20 > if (grub_strcmp (alias->type, "network") !=3D 0) > return 0; > @@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias *a= lias) > =20 > #define SUFFIX ":speed=3Dauto,duplex=3Dauto,1.1.1.1,dummy,1.1.1.1,1.1.1.= 1,5,5,1.1.1.1,512" > =20 > - if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX)) > + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX)) > + need_suffix =3D 0; > + > + /* sun4v vnet devices do not support setting duplex/speed */ > + { > + char tmp[24]; > + > + grub_ieee1275_finddevice (alias->path, &devhandle); > + > + if (!grub_ieee1275_get_property (devhandle, "compatible", > + (grub_uint8_t *)tmp, sizeof(tmp), NULL)) > + { > + if (!grub_strncmp (tmp, "SUNW,sun4v-network", > + sizeof("SUNW,sun4v-network"))) Is grub_strncmp intentional? Can it have some suffix that we want to ignore here? "compatible" property is defined as array of strings. Can it contain more than one value here? > + need_suffix =3D 0; > + } > + } > + =20 > + if (need_suffix) > ofdata->path =3D grub_malloc (grub_strlen (alias->path) + sizeof (SU= FFIX)); > else > ofdata->path =3D grub_malloc (grub_strlen (alias->path) + 1); > @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias *al= ias) > return 0; > } > ofdata->suffix =3D grub_stpcpy (ofdata->path, alias->path); > - if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX)) > + if (need_suffix) > grub_memcpy (ofdata->suffix, SUFFIX, sizeof (SUFFIX)); > else > *ofdata->suffix =3D '\0';