• Jack Morgenstein's avatar
    net/mlx4_core: Replace VF zero mac with random mac in mlx4_core · 2b3ddf27
    Jack Morgenstein authored
    By design, when no default MAC addresses are set in the Hypervisor for VFs,
    the VFs are passed zero-macs. When such a MAC is received by the VF, it
    generates a random MAC address and registers that MAC address
    with the Hypervisor.
    
    This random mac generation is currently done in the mlx4_en module.
    There is a problem, though, if the mlx4_ib module is loaded by a VF before
    the mlx4_en module. In this case, for RoCE, mlx4_ib will see the un-replaced
    zero-mac and register that zero-mac as part of QP1 initialization.
    
    Having a zero-mac in the port's MAC table creates problems for a
    Baseboard Management Console. The BMC occasionally sends packets with a
    zero-mac destination MAC. If there is a zero-mac present in the port's
    MAC table, the FW will send such BMC packets to the host driver rather than
    to the wire, and BMC will stop working.
    
    To address this problem, we move the replacement of zero-mac addresses
    with random-mac addresses to procedure mlx4_slave_cap(), which is part of the
    driver startup for VFs, and is before activation of mlx4_ib and mlx4_en.
    As a result, zero-mac addresses will never be registered in the port MAC table
    by the driver.
    
    In addition, when mlx4_en does initialize the net device, it needs to set
    the NET_ADDR_RANDOM flag in the netdev structure if the address was
    randomly generated. This is done so that udev on the VM does not create
    a new device name after each VF probe (VM boot and such). To accomplish this,
    we add a per-port flag in mlx4_dev which gets set whenever mlx4_core replaces
    a zero-mac with a randomly-generated mac. This flag is examined when mlx4_en
    initializes the net-device.
    
    Fix was suggested by Matan Barak <matanb@mellanox.com>
    Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2b3ddf27
en_netdev.c 85.2 KB