[SLOF] [PATCH v2 10/19] virtio-net: move setup-mac to the open routine
Nikunj A Dadhania
nikunj at linux.vnet.ibm.com
Thu Jan 21 18:57:12 AEDT 2016
Thomas Huth <thuth at redhat.com> writes:
> On 20.01.2016 13:10, Nikunj A Dadhania wrote:
>> MAC reading should be done after the initialization of the device after
>> the features negotiation.
>> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
>> board-qemu/slof/virtio-net.fs | 22 +++++++++++-----------
>> 1 file changed, 11 insertions(+), 11 deletions(-)
>> diff --git a/board-qemu/slof/virtio-net.fs b/board-qemu/slof/virtio-net.fs
>> index 412b34f..5414dd1 100644
>> --- a/board-qemu/slof/virtio-net.fs
>> +++ b/board-qemu/slof/virtio-net.fs
>> @@ -21,9 +21,20 @@ virtiodev virtio-setup-vd
>> 0 VALUE virtio-net-priv
>> 0 VALUE open-count
>> +\ Set up MAC address from config virtqueue
>> +6 BUFFER: local-mac
>> +: setup-mac ( -- )
>> + 6 0 DO
>> + virtiodev i 1 virtio-get-config
>> + local-mac i + c!
>> + LOOP
>> + local-mac 6 encode-bytes s" local-mac-address" property
>> : open ( -- okay? )
>> open-count 0= IF
>> open IF
>> + setup-mac
> This way, a new "local-mac-address" property will be created each time
> the device tree node is opened (and closed inbetween) again.
with open-count, this will happen only once, am I missing something
here? Are you suggesting multiple clients opening same device.
> That's somewhat ugly. Maybe you could add some code to "setup-mac"
> that checks whether the property is already available and only sets it
> if it is not there yet?
That would be simple to add to setup-mac:
s" local-mac-address" get-node get-property not IF 2drop EXIT THEN
More information about the SLOF