Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp174378imd; Wed, 31 Oct 2018 16:49:13 -0700 (PDT) X-Google-Smtp-Source: AJdET5cBeZskMcfsvp1lBABOXnBVFJClQPBo2d22U3urQKS82hLK9jNOrfnHHbLAoNfWKE8wX2Ne X-Received: by 2002:a62:6f43:: with SMTP id k64-v6mr5211823pfc.87.1541029753261; Wed, 31 Oct 2018 16:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029753; cv=none; d=google.com; s=arc-20160816; b=sFpiG9nmZ2HiyoLeqXBa5S8LuayajoqtQKjySD5nj0Ar5uAvtb3da2XMTYBhaT7HN3 WfQpljbvaqtM9h5x6I7yUSPZTuAy5mPo8uUGGOfw3bMAJ/hcHKRmZImWRoKHc/3BkLUK TlpuQmtL/A35n0br0Uy7QCloEckeUlVHJlhUO9JkxE4GREwqXel4HKWUNPLx1+Adfk8z 3W1n51WPbSVeFfaU0xuYgsmKFrTSUY8vAwqlsbQMiP5J9XY10TM97KFuYeRN1Sg/ZOx/ XFqFH87IlC0w6QwoZ8rK2GencW/lV8PgNR/UfY6WIHlmEovlqx2F/+2Y2Me4jRrIfmfw iNYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=0kozrpn6gFy8Bvb7KV5QYJ5dT1U4bm9ZitAd965DBl0=; b=YzjVAR76crTS3m9fPPlD9gpuXA2TpElU6gxtmHRz+RlwcEupD+c3uf+I/ubIz0QlD3 Torgywi62oa3fO8gUw1kM4r1UHepuyryk3YcSplnRRfLlJDZbwISyPWESuh5zxchVddh UQOEwhfZzC6WHxmcKpkDxL+8yxPFLvaU9cchGYDih3YlSBin4JXBDS+5rAJ+vcaiD2/Y ZPfz3DvCJFUtpZUotRxpEIS+98jJK86CBXjakHvywVsf8/NR5KwBuRWCF3W2nIZPcczv YJGqjYxYVEur/8YyJRMpB5TZ4HQBEG3N60OCRVH8XX+Arjoa194JEo9R5eQERKe9xPFL mPIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z58U96XS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4-v6si18679701pfb.43.2018.10.31.16.48.58; Wed, 31 Oct 2018 16:49:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z58U96XS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728611AbeKAIHG (ORCPT + 99 others); Thu, 1 Nov 2018 04:07:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:54512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728533AbeKAIHE (ORCPT ); Thu, 1 Nov 2018 04:07:04 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DBE220840; Wed, 31 Oct 2018 23:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027214; bh=CcRV/kLR6yrTXK2LsYZVJ1fn+J7L4h2aDCegqemHkzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z58U96XSi4wdcC9tcoo5DFROhn/Fp7dN/2HSvFJ+ZwFsE5DxcrGUyfUZJLQiWjAdh WbcModF76o6HBR/xSSzyf66jtqCNtg328y6LiDPn223AbYO8SGfIXP38ZdVYuAUgLp b6onOL3x1/cwprvFbS4j8owlKViWkKK+i4a1O/pM= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Shannon Nelson , Jeff Kirsher , Sasha Levin Subject: [PATCH AUTOSEL 4.19 078/146] ixgbe: disallow IPsec Tx offload when in SR-IOV mode Date: Wed, 31 Oct 2018 19:04:33 -0400 Message-Id: <20181031230541.28822-78-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shannon Nelson [ Upstream commit 47b6f50077e68bcd544f657526dad4bfdce7e87d ] There seems to be a problem in the x540's internal switch wherein if SR-IOV mode is enabled and an offloaded IPsec packet is sent to a local VF, the packet is silently dropped. This might never be a problem as it is somewhat a corner case, but if someone happens to be using IPsec offload from the PF to a VF that just happens to get migrated to the local box, communication will mysteriously fail. Not good. A simple way to protect from this is to simply not allow any IPsec offloads for outgoing packets when num_vfs != 0. This doesn't help any offloads that were created before SR-IOV was enabled, but we'll get to that later. Signed-off-by: Shannon Nelson Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c index da4322e4daed..add124e0381d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c @@ -676,6 +676,9 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs) } else { struct tx_sa tsa; + if (adapter->num_vfs) + return -EOPNOTSUPP; + /* find the first unused index */ ret = ixgbe_ipsec_find_empty_idx(ipsec, false); if (ret < 0) { -- 2.17.1