From patchwork Mon Mar 7 17:38:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iremonger, Bernard" X-Patchwork-Id: 11150 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 0F4E13772; Mon, 7 Mar 2016 18:38:46 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 301B22FDD for ; Mon, 7 Mar 2016 18:38:42 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 07 Mar 2016 09:38:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,552,1449561600"; d="scan'208";a="759666460" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 07 Mar 2016 09:38:39 -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 u27HcdYk032694; Mon, 7 Mar 2016 17:38:39 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u27HcdSR001965; Mon, 7 Mar 2016 17:38:39 GMT Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u27HcdbV001961; Mon, 7 Mar 2016 17:38:39 GMT From: Bernard Iremonger To: dev@dpdk.org Date: Mon, 7 Mar 2016 17:38:26 +0000 Message-Id: <1457372306-1746-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1457372306-1746-1-git-send-email-bernard.iremonger@intel.com> References: <1456498163-26619-1-git-send-email-bernard.iremonger@intel.com> <1457372306-1746-1-git-send-email-bernard.iremonger@intel.com> Cc: wenzhou.lu@intel.com Subject: [dpdk-dev] [PATCH v3 3/3] ixgbe: fix dev_close to remove 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Call the ixgbevf_remove_mac_addr() function in the ixgbevf_dev_close() function to ensure that the VF traffic goes to the PF after stop, close and detach of the VF. Fixes: af75078fece3 ("first public release") Signed-off-by: Bernard Iremonger --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++-- drivers/net/ixgbe/ixgbe_pf.c | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 759177a..96b42f8 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3911,8 +3911,12 @@ ixgbevf_dev_close(struct rte_eth_dev *dev) ixgbe_dev_free_queues(dev); - /* reprogram the RAR[0] in case user changed it. */ - ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); + /** + * Remove the VF MAC address ro ensure + * that the VF traffic goes to the PF + * after stop, close and detach of the VF + **/ + ixgbevf_remove_mac_addr(dev, 0); } static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on) 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;