From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AFCD92BA0 for ; Wed, 24 Feb 2016 17:19:17 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 24 Feb 2016 08:19:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,494,1449561600"; d="scan'208";a="923031341" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 24 Feb 2016 08:19:15 -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 u1OGJExP005499; Wed, 24 Feb 2016 16:19:14 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u1OGJECs015444; Wed, 24 Feb 2016 16:19:14 GMT Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u1OGJEBD015436; Wed, 24 Feb 2016 16:19:14 GMT From: Bernard Iremonger To: dev@dpdk.org Date: Wed, 24 Feb 2016 16:19:06 +0000 Message-Id: <1456330746-15001-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1456330746-15001-1-git-send-email-bernard.iremonger@intel.com> References: <1456330746-15001-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH 3/3] ixgbe: allow use of zero MAC address with VF 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: Wed, 24 Feb 2016 16:19:18 -0000 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. Fixes: af75078fece3 ("first public release") Fixes: 00e30184daa0 ("ixgbe: add PF support") Signed-off-by: Bernard Iremonger --- drivers/net/ixgbe/ixgbe_ethdev.c | 10 +++++++++- drivers/net/ixgbe/ixgbe_pf.c | 4 ++-- 2 files changed, 11 insertions(+), 3 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..db2dba4 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,7 +445,7 @@ 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)) { + if (is_unicast_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); } -- 2.6.3