On 11/21/2013 01:04 PM, Vlad Yasevich wrote:
> e1000 provides a E1000_RAH_AV bit on every complete write
> to the Receive Address Register.  We can use this bit
> 2 ways:
>  1) To trigger HMP notifications.  When the bit is set the
>     mac address is fully set and we can update the HMP.
> 
>  2) We can turn off he bit on the write to low order bits of

s/he/the/

>     the Receive Address Register, so that we would not try
>     to match received traffic to this address when it is
>     not completely set.
> 
> Signed-off-by: Vlad Yasevich <vyase...@redhat.com>
> ---
>  hw/net/e1000.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

>  
> -    if (index == RA || index == RA + 1) {
> +    switch (index) {
> +    case RA:
> +        /* Mask off AV bit on the write of the low dword.  The write of
> +         * the high dword will set the bit.  This way a half-written
> +         * mac address will not be used to filter on rx.
> +         */
> +        s->mac_reg[RA+1] &= ~E1000_RAH_AV;

Does real hardware also auto-clear this bit when writing the low word
(thus forcing all drivers to write high word last to make a change take
effect)?  Or are we risking the case of a driver that writes high word
first including the bit, and where real hardware just glitches over the
temporary half-written address where our emulation locks the user out
entirely?  (Asked by someone that has not read the datasheet, so take
with a grain of salt)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to