From patchwork Tue Dec 12 23:36:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 847666 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="D8V2N2ed"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yxGT05ld6z9t3M for ; Wed, 13 Dec 2017 10:37:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbdLLXhW (ORCPT ); Tue, 12 Dec 2017 18:37:22 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:41790 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710AbdLLXhV (ORCPT ); Tue, 12 Dec 2017 18:37:21 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vBCNU74O095752; Tue, 12 Dec 2017 23:37:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=y1kmd30ae7f6xnFqbboIzUMqFeb9Q5ou1CRCXy+OOzQ=; b=D8V2N2edi6l6scEVaicJwB80GdRBUaX1EHn7cgTYovrKq7WttGLBL96ftPq+SO4SFyHu cKfRgFggJDQA95kP2klXaLYzm0Yc5ogl7fpn5K6sHa2tpomWI/o2EFwacKc8fnwl/c7U hxqV0PUgpJ7Gy9uPn4rA/YV6NAxrYFA0oqcZzzXH64BV9fXmUKF04xMDgrdKvOBYqVov 1zBy0kfddV52SXvt1UlZrZcMg/L3nRh5lqtNBoTn/bl+80h4/1CoZ026u5HrXMOq4k3V 079/Ilp2Sz1MvWL1z64t0iVpyOH2bryw9TZD9lSqR7yHB7esuJ1CYq689yNbvjvsLU9x OA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2etrue80x1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Dec 2017 23:37:14 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vBCNbD7K029223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Dec 2017 23:37:13 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vBCNbCL3006377; Tue, 12 Dec 2017 23:37:13 GMT Received: from slnelson-mint18.us.oracle.com (/10.159.225.160) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 12 Dec 2017 15:37:12 -0800 From: Shannon Nelson To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Cc: netdev@vger.kernel.org, steffen.klassert@secunet.com, sowmini.varadhan@oracle.com Subject: [PATCH v2 next-queue 00/10] ixgbe: Add ipsec offload Date: Tue, 12 Dec 2017 15:36:53 -0800 Message-Id: <1513121823-27944-1-git-send-email-shannon.nelson@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8743 signatures=668646 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712120331 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is an implementation of the ipsec hardware offload feature for the ixgbe driver and Intel's 10Gbe series NICs: x540, x550, 82599. These patches apply to net-next v4.14 as well as Jeff Kirsher's next-queue v4.15-rc1-206-ge47375b. The ixgbe NICs support ipsec offload for 1024 Rx and 1024 Tx Security Associations (SAs), using up to 128 inbound IP addresses, and using the rfc4106(gcm(aes)) encryption. This code does not yet support IPv6, checksum offload, or TSO in conjunction with the ipsec offload - those will be added in the future. This code shows improvements in both packet throughput and CPU utilization. For example, here are some quicky numbers that show the magnitude of the performance gain on a single run of "iperf -c " with the ipsec offload on both ends of a point-to-point connection: 9.4 Gbps - normal case 7.6 Gbps - ipsec with offload 343 Mbps - ipsec no offload To set up a similar test case, you first need to be sure you have a recent version of iproute2 that supports the ipsec offload tag, probably something from ip 4.12 or newer would be best. I have a shell script that builds up the appropriate commands for me, but here are the resulting commands for all tcp traffic between 14.0.0.52 and 14.0.0.70: For the left side (14.0.0.52): ip x p add dir out src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp tmpl \ proto esp src 14.0.0.52 dst 14.0.0.70 spi 0x07 mode transport reqid 0x07 ip x p add dir in src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp tmpl \ proto esp dst 14.0.0.52 src 14.0.0.70 spi 0x07 mode transport reqid 0x07 ip x s add proto esp src 14.0.0.52 dst 14.0.0.70 spi 0x07 mode transport \ reqid 0x07 replay-window 32 \ aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \ sel src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp offload dev eth4 dir out ip x s add proto esp dst 14.0.0.52 src 14.0.0.70 spi 0x07 mode transport \ reqid 0x07 replay-window 32 \ aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \ sel src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp offload dev eth4 dir in For the right side (14.0.0.70): ip x p add dir out src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp tmpl \ proto esp src 14.0.0.70 dst 14.0.0.52 spi 0x07 mode transport reqid 0x07 ip x p add dir in src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp tmpl \ proto esp dst 14.0.0.70 src 14.0.0.52 spi 0x07 mode transport reqid 0x07 ip x s add proto esp src 14.0.0.70 dst 14.0.0.52 spi 0x07 mode transport \ reqid 0x07 replay-window 32 \ aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \ sel src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp offload dev eth4 dir out ip x s add proto esp dst 14.0.0.70 src 14.0.0.52 spi 0x07 mode transport \ reqid 0x07 replay-window 32 \ aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \ sel src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp offload dev eth4 dir in In both cases, the command "ip x s flush ; ip x p flush" will clean it all out and remove the offloads. Lastly, thanks to Alex Duyck for his early comments. Please see the individual patches for version update info. Shannon Nelson (10): ixgbe: clean up ipsec defines ixgbe: add ipsec register access routines ixgbe: add ipsec engine start and stop routines ixgbe: add ipsec data structures ixgbe: add ipsec offload add and remove SA ixgbe: restore offloaded SAs after a reset ixgbe: process the Rx ipsec offload ixgbe: process the Tx ipsec offload ixgbe: ipsec offload stats ixgbe: register ipsec offload with the xfrm subsystem drivers/net/ethernet/intel/ixgbe/Makefile | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe.h | 33 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 + drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 923 +++++++++++++++++++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.h | 92 +++ drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 39 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 22 +- 8 files changed, 1093 insertions(+), 23 deletions(-) create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.h