From patchwork Tue Oct 20 20:28:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 533164 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 02DFC14110E for ; Wed, 21 Oct 2015 07:28:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mirantis.com header.i=@mirantis.com header.b=W0wyhn3T; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248AbbJTU2T (ORCPT ); Tue, 20 Oct 2015 16:28:19 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34881 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbbJTU2S (ORCPT ); Tue, 20 Oct 2015 16:28:18 -0400 Received: by pasz6 with SMTP id z6so31054748pas.2 for ; Tue, 20 Oct 2015 13:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com; s=google; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=M9yVf8WgDDz/TIg58MFHbw3Ox3Oj0PXcJOiwI417BM8=; b=W0wyhn3TwQJf6BkV4eEe77j9lj7gt7RqGsDaONT1eURzC+pp8hxmGtc4PrskPEVDni mPuw49foQJ3xCl9sGf0s9pSL5dOWW4nCBS/jzi22+DdOD+cqoQwJrtnTwQA7Q7YU/161 SR1cwJimmF3NKnImAHbgVwDO0bC3JRWg5r7ww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=M9yVf8WgDDz/TIg58MFHbw3Ox3Oj0PXcJOiwI417BM8=; b=kdlqsHJuwhPkJ7GC72xytdt8hOthMJdJPR88lud7fhLq5wmm/M2JTNw63rKa++PbBp 9qe0vEEQ82UE2uSyLva8uW1CYHoVEwlvodwrfuPJb/2fbuS88FFX98dFmgjmpKwIbmym RCUvqfQHJK3FFB0w412t0BVNuTIe2KKe7GRDa9MyW0bhRwBLZuOqy07LdfUtEfV26U2o Q3k2RDUgmYeRrvTe+yDDfacF1DiC1nEVYDkAiyHctyH/eXT6EGubcE4lGfr43kiN90uL 3uxHV7sMM6V59ISgkz9JkYQFh4wI/4Pza85D01qk5Zs0yMSaW+er35OtOVsmaf5uqpWF 8S5Q== X-Gm-Message-State: ALoCoQl8FcH2nbXe7h8uKGwiXyDYu1q0L5hm5xd1+hU0J6GJ/ptaACgCE9mO3hbB7lfjcqPwU76U X-Received: by 10.66.248.227 with SMTP id yp3mr6044145pac.108.1445372898285; Tue, 20 Oct 2015 13:28:18 -0700 (PDT) Received: from [192.168.122.149] (static-50-53-21-5.bvtn.or.frontiernet.net. [50.53.21.5]) by smtp.gmail.com with ESMTPSA id b6sm5272490pbu.90.2015.10.20.13.28.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 13:28:17 -0700 (PDT) Subject: [net PATCH v2] ixgbe: Reset interface after enabling SR-IOV From: Alexander Duyck To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: jeffrey.t.kirsher@intel.com Date: Tue, 20 Oct 2015 13:28:17 -0700 Message-ID: <20151020202715.2955.88128.stgit@ahduyck-vm-fedora22> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Enabling SR-IOV and then bringing the interface up was resulting in the PF MAC addresses getting into a bad state. Specifically the MAC address was enabled for both VF 0 and the PF. This resulted in some odd behaviors such as VF 0 receiving a copy of the PFs traffic, which in turn enables the ability for VF 0 to spoof the PF. A workaround for this issue appears to be to bring up the interface first and then enable SR-IOV as this way the reset is then triggered in the existing code. In order to correct this I have added a change to ixgbe_setup_tc where if the interface is down we still will at least call ixgbe_reset so that the MAC addresses for the device are reset to the correct pools. Steps to reproduce issue: modprobe ixgbe echo 7 > /sys/bus/pci/devices/0000\:01\:00.1/sriov_numvfs ifconfig enp1s0f1 up ethregs -s 1:00.1 | grep MPSAR | grep -v 00000000 Result: MPSAR[0] 00000081 MPSAR[254] 00000001 Expected Result, behavior after patch: MPSAR[0] 00000080 MPSAR[254] 00000080 Signed-off-by: Alexander Duyck Signed-off-by: Alexander Duyck Tested-by: Darin Miller --- This is also a candidate for stable going back to 3.9 kernel as that appears to be where the code for using ixgbe_setup_tc as a part of the SR-IOV initialization was introduced. v2: Replaced dev with adapter as parameter for ixgbe_reset(). drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +++ 1 file changed, 3 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 191003901adb..7831346b483d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -7912,6 +7912,9 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) */ if (netif_running(dev)) ixgbe_close(dev); + else + ixgbe_reset(adapter); + ixgbe_clear_interrupt_scheme(adapter); #ifdef CONFIG_IXGBE_DCB