From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1F69A5596 for ; Fri, 26 Feb 2016 15:50:07 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 26 Feb 2016 06:50:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="911885300" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 26 Feb 2016 06:50:07 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u1QEo5w3011222; Fri, 26 Feb 2016 14:50:05 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u1QEo4kA027401; Fri, 26 Feb 2016 14:50:04 GMT Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u1QEo4FV027397; Fri, 26 Feb 2016 14:50:04 GMT From: Bernard Iremonger To: dev@dpdk.org Date: Fri, 26 Feb 2016 14:49:23 +0000 Message-Id: <1456498163-26619-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1456498163-26619-1-git-send-email-bernard.iremonger@intel.com> References: <1456330746-15001-1-git-send-email-bernard.iremonger@intel.com> <1456498163-26619-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH 3/3 v2] ixgbe: fix setting of VF MAC address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2016 14:50:08 -0000 Fix setting of VF MAC address to allow a zero address. Reprogram the RAR[0] with a zero MAC address, to ensure ensure that the VF traffic goes to the PF after stop, close and detach of the VF. Fixes: af75078fece3 ("first public release") Fixes: 00e30184daa0 ("ixgbe: add PF support") ixgbe: don't overwrite perm addr Signed-off-by: Bernard Iremonger --- drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++++- drivers/net/ixgbe/ixgbe_pf.c | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 759177a..5608f67 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3902,6 +3902,7 @@ static void ixgbevf_dev_close(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ether_addr *addr = (struct ether_addr *)hw->mac.addr; PMD_INIT_FUNC_TRACE(); @@ -3911,7 +3912,14 @@ ixgbevf_dev_close(struct rte_eth_dev *dev) ixgbe_dev_free_queues(dev); - /* reprogram the RAR[0] in case user changed it. */ + memset(addr->addr_bytes, 0, ETHER_ADDR_LEN); + + /** + * reprogram the RAR[0] with a zero mac address. + * to ensure that the VF traffic goes to the PF + * after stop, close and detach of the VF + **/ + ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 2ffbd1f..e5cfd05 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_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 @@ -445,8 +445,9 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (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, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } return -1; -- 2.6.3