From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZYuFR-00037V-1o for mharc-grub-devel@gnu.org; Mon, 07 Sep 2015 07:06:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYuFK-0002xm-8R for grub-devel@gnu.org; Mon, 07 Sep 2015 07:05:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYuFF-0008QF-P2 for grub-devel@gnu.org; Mon, 07 Sep 2015 07:05:58 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:22429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYuFF-0008P8-1s for grub-devel@gnu.org; Mon, 07 Sep 2015 07:05:53 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t87B5oQt024906 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Sep 2015 11:05:50 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t87B5nqe002088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 7 Sep 2015 11:05:50 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t87B5nWR003699; Mon, 7 Sep 2015 11:05:49 GMT Received: from [10.162.81.23] (/10.162.81.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Sep 2015 04:05:49 -0700 Message-ID: <55ED6F8A.7050904@oracle.com> Date: Mon, 07 Sep 2015 14:05:46 +0300 From: Stanislav Kholmanskikh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Andrei Borzenkov Subject: Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices References: <1437031301-28898-1-git-send-email-stanislav.kholmanskikh@oracle.com> <20150808114755.567a82b9@opensuse.site> In-Reply-To: <20150808114755.567a82b9@opensuse.site> Content-Type: text/plain; charset=utf-8; format=flowed X-Source-IP: userv0021.oracle.com [156.151.31.71] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by aserp1040.oracle.com id t87B5oQt024906 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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: Mon, 07 Sep 2015 11:05:59 -0000 Hi. On 08/08/2015 11:47 AM, Andrei Borzenkov wrote: > =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: >> >> ok select net:speed=3Dauto,duplex=3Dauto >> Unknown key 'speed' >> Unknown key 'duplex' >> Manual Configuration: Host IP, boot server and filename must be specif= ied >> WARNING: /virtual-devices@100/channel-devices@200/network@0: Can't ope= n OBP standard TFTP package >> >> Can't open device >> ok >> >> Therefore, let's not set SUFFIX for such devices. >> >> Signed-off-by: Stanislav Kholmanskikh >> --- >> grub-core/net/drivers/ieee1275/ofnet.c | 23 +++++++++++++++++++++-= - >> 1 files changed, 21 insertions(+), 2 deletions(-) >> >> diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/dr= ivers/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 = *alias) >> grub_uint64_t prop; >> grub_uint8_t *pprop; >> char *shortname; >> + char need_suffix =3D 1; >> >> if (grub_strcmp (alias->type, "network") !=3D 0) >> return 0; >> @@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias= *alias) >> >> #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" >> >> - 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? My point was to match "SUNW,sun4v-network" exactly. > > "compatible" property is defined as array of strings. Can it contain > more than one value here? In accordance to the Virtual Machine Specification, sections 8.23.4.2=20 and 8.23.4.3: https://kenai.com/downloads/hypervisor/Hypervisor-api-2.0.pdf it contains single value - "SUNW,sun4v-network". But yes, indeed, "compatible" is an array of strings, and may contain=20 multiple values here (at least in the future, of one decides to update=20 vnet specs). I missed that. So on I'm fixing my patch to tread "compatible" as an array, and will=20 send an updated version in a moment. Thank you for review. > >> + need_suffix =3D 0; >> + } >> + } >> + >> + if (need_suffix) >> ofdata->path =3D grub_malloc (grub_strlen (alias->path) + sizeof= (SUFFIX)); >> else >> ofdata->path =3D grub_malloc (grub_strlen (alias->path) + 1); >> @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias = *alias) >> 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'; >