All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ofnet: Do not set SUFFIX for sun4v network devices
@ 2015-07-16  7:21 Stanislav Kholmanskikh
  2015-07-17 16:58 ` Andrei Borzenkov
  2015-08-08  8:47 ` Andrei Borzenkov
  0 siblings, 2 replies; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2015-07-16  7:21 UTC (permalink / raw)
  To: grub-devel; +Cc: vasily.isaenko, allen.pais

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=auto,duplex=auto
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 OBP standard TFTP package

Can't open device
ok

Therefore, let's not set SUFFIX for such devices.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 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/drivers/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 = 1;
 
   if (grub_strcmp (alias->type, "network") != 0)
     return 0;
@@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
 
 #define SUFFIX ":speed=auto,duplex=auto,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 = 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")))
+	  need_suffix = 0;
+      }
+  }
+  
+  if (need_suffix)
     ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
   else
     ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
@@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
       return 0;
     }
   ofdata->suffix = 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 = '\0';
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices
  2015-07-16  7:21 [PATCH] ofnet: Do not set SUFFIX for sun4v network devices Stanislav Kholmanskikh
@ 2015-07-17 16:58 ` Andrei Borzenkov
  2015-07-21  7:48   ` Stanislav Kholmanskikh
  2015-08-08  8:47 ` Andrei Borzenkov
  1 sibling, 1 reply; 9+ messages in thread
From: Andrei Borzenkov @ 2015-07-17 16:58 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, grub-devel, allen.pais

В Thu, 16 Jul 2015 10:21:41 +0300
Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> пишет:

> 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=auto,duplex=auto
> 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 OBP standard TFTP package
> 
> Can't open device
> ok
> 
> Therefore, let's not set SUFFIX for such devices.
> 
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
>  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/drivers/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 = 1;
>  
>    if (grub_strcmp (alias->type, "network") != 0)
>      return 0;
> @@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>  
>  #define SUFFIX ":speed=auto,duplex=auto,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 = 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")))
> +	  need_suffix = 0;
> +      }
> +  }
> +  

Can it have devices that do support suffix? If no, it is better to
extend grub-core/kern/ieee1275/cmain.c:grub_ieee1275_find_options() and
set GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX for the platform.

> +  if (need_suffix)
>      ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
>    else
>      ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
> @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>        return 0;
>      }
>    ofdata->suffix = 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 = '\0';



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices
  2015-07-17 16:58 ` Andrei Borzenkov
@ 2015-07-21  7:48   ` Stanislav Kholmanskikh
  2015-07-29 10:10     ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2015-07-21  7:48 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: vasily.isaenko, allen.pais



On 07/17/2015 07:58 PM, Andrei Borzenkov wrote:
> В Thu, 16 Jul 2015 10:21:41 +0300
> Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> пишет:
>
>> 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=auto,duplex=auto
>> 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 OBP standard TFTP package
>>
>> Can't open device
>> ok
>>
>> Therefore, let's not set SUFFIX for such devices.
>>
>> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
>> ---
>>   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/drivers/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 = 1;
>>
>>     if (grub_strcmp (alias->type, "network") != 0)
>>       return 0;
>> @@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>>
>>   #define SUFFIX ":speed=auto,duplex=auto,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 = 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")))
>> +	  need_suffix = 0;
>> +      }
>> +  }
>> +
>
> Can it have devices that do support suffix? If no, it is better to
> extend grub-core/kern/ieee1275/cmain.c:grub_ieee1275_find_options() and
> set GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX for the platform.

A ldom may have both virtual an physical network devices at the same 
time. One can assign entire PCIE root complexes, individual cards or 
SR-IOV virtual functions to a ldom. More details are:

https://docs.oracle.com/cd/E38405_01/html/E38406/usingpcibuseswithldoms.html#scrolltoc

Thanks.

>
>> +  if (need_suffix)
>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
>>     else
>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
>> @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>>         return 0;
>>       }
>>     ofdata->suffix = 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 = '\0';
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices
  2015-07-21  7:48   ` Stanislav Kholmanskikh
@ 2015-07-29 10:10     ` Stanislav Kholmanskikh
  0 siblings, 0 replies; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2015-07-29 10:10 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: vasily.isaenko, allen.pais

Hi!

On 07/21/2015 10:48 AM, Stanislav Kholmanskikh wrote:
>
>
> On 07/17/2015 07:58 PM, Andrei Borzenkov wrote:
>> В Thu, 16 Jul 2015 10:21:41 +0300
>> Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> пишет:
>>
>>> 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=auto,duplex=auto
>>> 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 OBP standard TFTP package
>>>
>>> Can't open device
>>> ok
>>>
>>> Therefore, let's not set SUFFIX for such devices.
>>>
>>> Signed-off-by: Stanislav Kholmanskikh
>>> <stanislav.kholmanskikh@oracle.com>
>>> ---
>>>   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/drivers/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 = 1;
>>>
>>>     if (grub_strcmp (alias->type, "network") != 0)
>>>       return 0;
>>> @@ -325,7 +326,25 @@ search_net_devices (struct
>>> grub_ieee1275_devalias *alias)
>>>
>>>   #define SUFFIX
>>> ":speed=auto,duplex=auto,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 = 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")))
>>> +      need_suffix = 0;
>>> +      }
>>> +  }
>>> +
>>
>> Can it have devices that do support suffix? If no, it is better to
>> extend grub-core/kern/ieee1275/cmain.c:grub_ieee1275_find_options() and
>> set GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX for the platform.
>
> A ldom may have both virtual an physical network devices at the same
> time. One can assign entire PCIE root complexes, individual cards or
> SR-IOV virtual functions to a ldom. More details are:
>
> https://docs.oracle.com/cd/E38405_01/html/E38406/usingpcibuseswithldoms.html#scrolltoc

So a ldom may have devices that do support the suffix and that do not 
support the suffix.

>
>
> Thanks.
>
>>
>>> +  if (need_suffix)
>>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof
>>> (SUFFIX));
>>>     else
>>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
>>> @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias
>>> *alias)
>>>         return 0;
>>>       }
>>>     ofdata->suffix = 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 = '\0';
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices
  2015-07-16  7:21 [PATCH] ofnet: Do not set SUFFIX for sun4v network devices Stanislav Kholmanskikh
  2015-07-17 16:58 ` Andrei Borzenkov
@ 2015-08-08  8:47 ` Andrei Borzenkov
  2015-09-07 11:05   ` Stanislav Kholmanskikh
  1 sibling, 1 reply; 9+ messages in thread
From: Andrei Borzenkov @ 2015-08-08  8:47 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, grub-devel, allen.pais

В Thu, 16 Jul 2015 10:21:41 +0300
Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> пишет:

> 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=auto,duplex=auto
> 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 OBP standard TFTP package
> 
> Can't open device
> ok
> 
> Therefore, let's not set SUFFIX for such devices.
> 
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
>  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/drivers/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 = 1;
>  
>    if (grub_strcmp (alias->type, "network") != 0)
>      return 0;
> @@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>  
>  #define SUFFIX ":speed=auto,duplex=auto,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 = 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 = 0;
> +      }
> +  }
> +  
> +  if (need_suffix)
>      ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
>    else
>      ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
> @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>        return 0;
>      }
>    ofdata->suffix = 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 = '\0';



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] ofnet: Do not set SUFFIX for sun4v network devices
  2015-08-08  8:47 ` Andrei Borzenkov
@ 2015-09-07 11:05   ` Stanislav Kholmanskikh
  2015-09-07 11:13     ` [PATCH V2] " Stanislav Kholmanskikh
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2015-09-07 11:05 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: vasily.isaenko, grub-devel, allen.pais

Hi.

On 08/08/2015 11:47 AM, Andrei Borzenkov wrote:
> В Thu, 16 Jul 2015 10:21:41 +0300
> Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> пишет:
>
>> 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=auto,duplex=auto
>> 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 OBP standard TFTP package
>>
>> Can't open device
>> ok
>>
>> Therefore, let's not set SUFFIX for such devices.
>>
>> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
>> ---
>>   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/drivers/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 = 1;
>>
>>     if (grub_strcmp (alias->type, "network") != 0)
>>       return 0;
>> @@ -325,7 +326,25 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>>
>>   #define SUFFIX ":speed=auto,duplex=auto,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 = 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 
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 
multiple values here (at least in the future, of one decides to update 
vnet specs). I missed that.

So on I'm fixing my patch to tread "compatible" as an array, and will 
send an updated version in a moment.

Thank you for review.

>
>> +	  need_suffix = 0;
>> +      }
>> +  }
>> +
>> +  if (need_suffix)
>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
>>     else
>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
>> @@ -335,7 +354,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>>         return 0;
>>       }
>>     ofdata->suffix = 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 = '\0';
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2] ofnet: Do not set SUFFIX for sun4v network devices
  2015-09-07 11:05   ` Stanislav Kholmanskikh
@ 2015-09-07 11:13     ` Stanislav Kholmanskikh
  2015-10-07 14:52       ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2015-09-07 11:13 UTC (permalink / raw)
  To: grub-devel; +Cc: vasily.isaenko, allen.pais

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=auto,duplex=auto
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 OBP standard TFTP package

Can't open device
ok

Therefore, let's not set SUFFIX for such devices.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
Changes since V1:
 * handle "compatible" property as an array of strings


 grub-core/net/drivers/ieee1275/ofnet.c |   41 ++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index eea8e71..13970bd 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 = 1;
 
   if (grub_strcmp (alias->type, "network") != 0)
     return 0;
@@ -325,7 +326,43 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
 
 #define SUFFIX ":speed=auto,duplex=auto,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 = 0;
+
+  /* sun4v vnet devices do not support setting duplex/speed */
+  {
+    char *ptr;
+
+    grub_ieee1275_finddevice (alias->path, &devhandle);
+
+    grub_ieee1275_get_property_length (devhandle, "compatible", &prop_size);
+    if (prop_size > 0)
+      {
+	pprop = grub_malloc (prop_size);
+	if (!pprop)
+	  {
+	    grub_free (card);
+	    grub_free (ofdata);
+	    grub_print_error ();
+	    return 1;
+	  }
+
+	if (!grub_ieee1275_get_property (devhandle, "compatible",
+					 pprop, prop_size, NULL))
+	  {
+	    for (ptr = (char *) pprop; ptr - (char *) pprop < prop_size;
+		 ptr += grub_strlen (ptr) + 1)
+	      {
+		if (!grub_strcmp(ptr, "SUNW,sun4v-network"))
+		  need_suffix = 0;
+	      }
+	}
+
+	grub_free (pprop);
+      }
+  }
+  
+  if (need_suffix)
     ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
   else
     ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
@@ -335,7 +372,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
       return 0;
     }
   ofdata->suffix = 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 = '\0';
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH V2] ofnet: Do not set SUFFIX for sun4v network devices
  2015-09-07 11:13     ` [PATCH V2] " Stanislav Kholmanskikh
@ 2015-10-07 14:52       ` Stanislav Kholmanskikh
  2015-10-07 17:01         ` Andrei Borzenkov
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Kholmanskikh @ 2015-10-07 14:52 UTC (permalink / raw)
  To: grub-devel; +Cc: vasily.isaenko, allen.pais

Hi!

On 09/07/2015 02:13 PM, Stanislav Kholmanskikh wrote:
> 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=auto,duplex=auto
> 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 OBP standard TFTP package
>
> Can't open device
> ok
>
> Therefore, let's not set SUFFIX for such devices.
>
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
> Changes since V1:
>   * handle "compatible" property as an array of strings

Could anybody look at it, please?

Thanks.


>
>
>   grub-core/net/drivers/ieee1275/ofnet.c |   41 ++++++++++++++++++++++++++++++-
>   1 files changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
> index eea8e71..13970bd 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 = 1;
>
>     if (grub_strcmp (alias->type, "network") != 0)
>       return 0;
> @@ -325,7 +326,43 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>
>   #define SUFFIX ":speed=auto,duplex=auto,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 = 0;
> +
> +  /* sun4v vnet devices do not support setting duplex/speed */
> +  {
> +    char *ptr;
> +
> +    grub_ieee1275_finddevice (alias->path, &devhandle);
> +
> +    grub_ieee1275_get_property_length (devhandle, "compatible", &prop_size);
> +    if (prop_size > 0)
> +      {
> +	pprop = grub_malloc (prop_size);
> +	if (!pprop)
> +	  {
> +	    grub_free (card);
> +	    grub_free (ofdata);
> +	    grub_print_error ();
> +	    return 1;
> +	  }
> +
> +	if (!grub_ieee1275_get_property (devhandle, "compatible",
> +					 pprop, prop_size, NULL))
> +	  {
> +	    for (ptr = (char *) pprop; ptr - (char *) pprop < prop_size;
> +		 ptr += grub_strlen (ptr) + 1)
> +	      {
> +		if (!grub_strcmp(ptr, "SUNW,sun4v-network"))
> +		  need_suffix = 0;
> +	      }
> +	}
> +
> +	grub_free (pprop);
> +      }
> +  }
> +
> +  if (need_suffix)
>       ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
>     else
>       ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
> @@ -335,7 +372,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
>         return 0;
>       }
>     ofdata->suffix = 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 = '\0';
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2] ofnet: Do not set SUFFIX for sun4v network devices
  2015-10-07 14:52       ` Stanislav Kholmanskikh
@ 2015-10-07 17:01         ` Andrei Borzenkov
  0 siblings, 0 replies; 9+ messages in thread
From: Andrei Borzenkov @ 2015-10-07 17:01 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: vasily.isaenko, allen.pais

07.10.2015 17:52, Stanislav Kholmanskikh пишет:
> Hi!
>
> On 09/07/2015 02:13 PM, Stanislav Kholmanskikh wrote:
>> 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=auto,duplex=auto
>> 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 OBP standard TFTP package
>>
>> Can't open device
>> ok
>>
>> Therefore, let's not set SUFFIX for such devices.
>>
>> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
>> ---
>> Changes since V1:
>>   * handle "compatible" property as an array of strings
>
> Could anybody look at it, please?
>

I was hoping you lost patience and fixed FCODE :)

Sorry for delay, applied.

> Thanks.
>
>
>>
>>
>>   grub-core/net/drivers/ieee1275/ofnet.c |   41
>> ++++++++++++++++++++++++++++++-
>>   1 files changed, 39 insertions(+), 2 deletions(-)
>>
>> diff --git a/grub-core/net/drivers/ieee1275/ofnet.c
>> b/grub-core/net/drivers/ieee1275/ofnet.c
>> index eea8e71..13970bd 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 = 1;
>>
>>     if (grub_strcmp (alias->type, "network") != 0)
>>       return 0;
>> @@ -325,7 +326,43 @@ search_net_devices (struct grub_ieee1275_devalias
>> *alias)
>>
>>   #define SUFFIX
>> ":speed=auto,duplex=auto,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 = 0;
>> +
>> +  /* sun4v vnet devices do not support setting duplex/speed */
>> +  {
>> +    char *ptr;
>> +
>> +    grub_ieee1275_finddevice (alias->path, &devhandle);
>> +
>> +    grub_ieee1275_get_property_length (devhandle, "compatible",
>> &prop_size);
>> +    if (prop_size > 0)
>> +      {
>> +    pprop = grub_malloc (prop_size);
>> +    if (!pprop)
>> +      {
>> +        grub_free (card);
>> +        grub_free (ofdata);
>> +        grub_print_error ();
>> +        return 1;
>> +      }
>> +
>> +    if (!grub_ieee1275_get_property (devhandle, "compatible",
>> +                     pprop, prop_size, NULL))
>> +      {
>> +        for (ptr = (char *) pprop; ptr - (char *) pprop < prop_size;
>> +         ptr += grub_strlen (ptr) + 1)
>> +          {
>> +        if (!grub_strcmp(ptr, "SUNW,sun4v-network"))
>> +          need_suffix = 0;
>> +          }
>> +    }
>> +
>> +    grub_free (pprop);
>> +      }
>> +  }
>> +
>> +  if (need_suffix)
>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof
>> (SUFFIX));
>>     else
>>       ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
>> @@ -335,7 +372,7 @@ search_net_devices (struct grub_ieee1275_devalias
>> *alias)
>>         return 0;
>>       }
>>     ofdata->suffix = 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 = '\0';
>>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-08 10:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-16  7:21 [PATCH] ofnet: Do not set SUFFIX for sun4v network devices Stanislav Kholmanskikh
2015-07-17 16:58 ` Andrei Borzenkov
2015-07-21  7:48   ` Stanislav Kholmanskikh
2015-07-29 10:10     ` Stanislav Kholmanskikh
2015-08-08  8:47 ` Andrei Borzenkov
2015-09-07 11:05   ` Stanislav Kholmanskikh
2015-09-07 11:13     ` [PATCH V2] " Stanislav Kholmanskikh
2015-10-07 14:52       ` Stanislav Kholmanskikh
2015-10-07 17:01         ` Andrei Borzenkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.