From: Bernard Iremonger Date: Wed, 2 Mar 2016 16:09:06 +0000 (+0000) Subject: e1000: fix VF MAC address on close X-Git-Tag: spdx-start~7414 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8361d1ccdddf3d5bcb6a4aaf077d4b3df80eff51;p=dpdk.git e1000: fix VF MAC address on close Allow reprogramming of the RAR with a zero mac address, to ensure that the VF traffic goes to the PF after stop, close and detach of the VF. Fixes: be2d648a2dd3 ("igb: add PF support") Fixes: d82170d27918 ("igb: add VF support") Signed-off-by: Bernard Iremonger Acked-by: Wenzhuo Lu --- diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 91fd13bb95..e3f50cc7ba 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -2842,6 +2842,7 @@ igbvf_dev_close(struct rte_eth_dev *dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct e1000_adapter *adapter = E1000_DEV_PRIVATE(dev->data->dev_private); + struct ether_addr addr; PMD_INIT_FUNC_TRACE(); @@ -2850,6 +2851,15 @@ igbvf_dev_close(struct rte_eth_dev *dev) igbvf_dev_stop(dev); adapter->stopped = 1; igb_dev_free_queues(dev); + + /** + * reprogram the RAR with a zero mac address, + * to ensure that the VF traffic goes to the PF + * after stop, close and detach of the VF. + **/ + + memset(&addr, 0, sizeof(addr)); + igbvf_default_mac_addr_set(dev, &addr); } static void diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index 1d00ddaed7..95204e97ee 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -332,8 +332,10 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.rar_entry_count - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct ether_addr*)new_mac)) { - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); + if (is_unicast_ether_addr((struct ether_addr *)new_mac)) { + if (!is_zero_ether_addr((struct ether_addr *)new_mac)) + rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, + sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); return 0; }