[SLOF] [PATCH v2 10/19] virtio-net: move setup-mac to the open routine

Thomas Huth thuth at redhat.com
Thu Jan 21 06:24:44 AEDT 2016


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. 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?

 Thomas




More information about the SLOF mailing list