Received: by 10.223.164.202 with SMTP id h10csp2826841wrb; Tue, 28 Nov 2017 01:52:17 -0800 (PST) X-Google-Smtp-Source: AGs4zMbEhjMflDatcZffdfUBbbv6OR9bPikZgrGl1+Vg+bhenxXCXFenVfCT7CrjGfYQmDv5cxmL X-Received: by 10.98.9.79 with SMTP id e76mr40292642pfd.70.1511862737306; Tue, 28 Nov 2017 01:52:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511862737; cv=none; d=google.com; s=arc-20160816; b=fy3D+ExE5vSSS0lQYNRKXy37mC1cNBjMs5DgNLqeThaCn3NEciRGWTvkGEafZyT7DG MhgbNttKuOTgCex/n3nOyLS2YdOHLPOaa2YaEe26QZBZTyZnUi2oUTxi2gsWeIWiM8dh a1LlKSH+Ab4Bh239PXnm16XodZ0QSG33NSImrlp5/Q40Hfz9Tbbju05p99ciSYBYd5ii Zwmf+EvfKhxXdqymRD7TwwCQrzhiO2KxRQKHLrXoLL6NXCEREiRYPSJ5eHTmV8kWNmBA tsOxvtO8Hv/w3jsxhELWLRNFFd5MftUCVnmkJw7P+6g2GHbith7aKvKWypA5IGAycFdr gE8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Dg8x/39yUZqVfUFOo7RbJAvGiR+PgCWBa0bcZQ2JUPs=; b=jsm+JcoWZ0fhhEZ/sH8LJ4LgaIKdMyKo264cpkVn1CEo5nGqIIGPsAwln892opibfY tBMK8kbIX7FBn2FP/4T5Z8u/x82DMPnrsmNhSk4ueLqESBm1QqW8XYtNAey7yTgWBqVQ rsXWHo1pOtkUfszr9z90tPQxnhfIzFfsS0ME0vb4zmYMIZfSq3QkBbNFxEQkbqxHAYqU UvArYHlv2glCrQaq05tWZBDvyNAqjx2dTFOWuxqERjWZp5rNk01grwfdcwZMyYLbsgR9 fvdtHt6rLT9iC608PEGmdol/hfmGyjUpfaDNC2vSm4I2yM5q9AOGgXRK2XIbPoUDjh+U n65Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector1 header.b=i1jyZM3P; 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=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x81si27034509pff.17.2017.11.28.01.52.05; Tue, 28 Nov 2017 01:52:17 -0800 (PST) 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=@Mellanox.com header.s=selector1 header.b=i1jyZM3P; 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=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbdK1JuA (ORCPT + 78 others); Tue, 28 Nov 2017 04:50:00 -0500 Received: from mail-ve1eur01on0057.outbound.protection.outlook.com ([104.47.1.57]:18016 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751660AbdK1Jtz (ORCPT ); Tue, 28 Nov 2017 04:49:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Dg8x/39yUZqVfUFOo7RbJAvGiR+PgCWBa0bcZQ2JUPs=; b=i1jyZM3Po1L8Un2yy8b8emXTd6Jbz6NwXRviifsbQlzGR0UMkov3K6Q+eyI8ezRwO4NqnYiVXOmbgvuDj/GQbxB0rJfsCRUa3C84G22eniJ4EKhSh9cC3qN7NS6rfie6JpRBa3a3Itb9eY6DTfUYrZE8fJByeVtAjNE1sdvNGw0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yossefe@mellanox.com; Received: from dev-l-vrt-187.mtl.labs.mlnx (82.166.227.17) by AM0PR0502MB3745.eurprd05.prod.outlook.com (2603:10a6:208:1e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Tue, 28 Nov 2017 09:49:51 +0000 From: yossefe@mellanox.com To: "David S. Miller" , Steffen Klassert , Herbert Xu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: borisp@mellanox.com, kliteyn@mellanox.com, yossiku@mellanox.com, Yossef Efraim Subject: [PATCH net-next 3/3] xfrm: Add ESN support for IPSec HW offload Date: Tue, 28 Nov 2017 11:49:30 +0200 Message-Id: <1511862571-3494-3-git-send-email-yossefe@mellanox.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1511862571-3494-1-git-send-email-yossefe@mellanox.com> References: <1511862571-3494-1-git-send-email-yossefe@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: AM5PR0102CA0002.eurprd01.prod.exchangelabs.com (2603:10a6:206::15) To AM0PR0502MB3745.eurprd05.prod.outlook.com (2603:10a6:208:1e::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 299cc782-4033-4819-3671-08d536455f3e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603258);SRVR:AM0PR0502MB3745; X-Microsoft-Exchange-Diagnostics: 1;AM0PR0502MB3745;3:05edHFZ6dPHOrIZy7icFT+bu9kYq9MwC6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nHlPnGeseR2XwWOCv9kH+Ovo3j4958eu0ZyykwkhRz7QlNq4hsHiYjjehYtJUgYH3GGGZjIBAQSsOybWROXH7bECTBy2V/DGkpXe3tOMzWIJsPzf7yElq4ejRo3WCOSX97Un2G4WZnI8m/N/l3eQ2GoCnxlE8shurNxs8RLtraih5fWZ9/jnZbggv87QXTjjzBnM2GHDTu7G7wJYWCFsGFt5ZWENRvnS1sg1LJP2215sxlZheqaBatUvYpTrepH4qXytQBXKcYjMXNv82b2DusZ3YYOuYYNvNgvK0pLZnWE8r7IR;4:AXzudG3VSh9PDyj2G8hhxtewf9bIxjuxUoNSdawrJfU4y07pCtg58rSZH8/jrInPGB33iaHyJfgrFhcNptq17CievDspyCvnvUY02b5tHnomSEbVJgitZ1hxeqRmzYd9czdKu6kN/ognKlD4zNI2OWWDg0WPcS/sZMFwEHJ6p3clTAfuHFuxfb6S6wRQPdc+axZ0J4LmYedswogDQ54zop3r/cQMDYZYbMivdt1CCc92iYrOGiIEPBp+kBomwO5A/h5XpfScd4pGbg1AtFEAFQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(3231022)(10201501046)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(20161123558100)(6072148)(201708071742011);SRVR:AM0PR0502MB3745;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:AM0PR0502MB3745; X-Forefront-PRVS: 0505147DDB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(366004)(376002)(346002)(199003)(189002)(66066001)(4326008)(68736007)(53936002)(6512007)(107886003)(9686003)(48376002)(50466002)(85782001)(6116002)(189998001)(86362001)(47776003)(3846002)(36756003)(52116002)(97736004)(51416003)(81166006)(81156014)(8676002)(8936002)(5660300001)(478600001)(316002)(33646002)(2950100002)(50226002)(7736002)(16526018)(6666003)(101416001)(110136005)(16586007)(106356001)(105586002)(2906002)(25786009)(76176999)(50986999)(305945005)(6486002)(85772001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR0502MB3745;H:dev-l-vrt-187.mtl.labs.mlnx;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM0PR0502MB3745;23:ojTat341i1h7TkqmytXG4qZYaI4II7NqgT5ckRB?= =?us-ascii?Q?nhGHXoeQi/NvWXOkAPSg3OP48Bc6TEpPCV1FPo2M6u0hBsLplaaUPugW9xNQ?= =?us-ascii?Q?K/vxy/sU53536Z0r6nAn2HosunvmPhn6XWm91JmV0hgyik7s8uk3rpcD8Q4Q?= =?us-ascii?Q?WZUxJVaPnhaxKFwhSOxgdUJK+7lq2yqgPt4RS3fX3/bQUbKf/WIq+4D5U85L?= =?us-ascii?Q?Twv1T5TgAP9+uKXc80wgL5l5r+mEAanitySTubWxpMQabb6ycakl+nDcE76F?= =?us-ascii?Q?K/a2GX/gZYTYQ3m7z/GDb9FzFfmUMdIvwJ9vU8SO9CRjKURLIIVkxxVYM4FX?= =?us-ascii?Q?ILW/5M6t96owCb/einYVg/uFDmeL66xqm1zUJ5Cjo2YOrM5LCqUUG53IJJ16?= =?us-ascii?Q?vm/jFQZy2BCZFgg83EiR5DKxCy9hMcwIQi1zSCOwpalnG1m+SwPanYJWehzA?= =?us-ascii?Q?TovC9KhWB7SJbp+DBGvThG3C14Iz24CfoihPGXQfag6dXZxMO3JSh8kIxdRy?= =?us-ascii?Q?Yex6q5R2Z9LZRMnadqRgrDmQ1zBCNlTmvBv0ZkZZV4XkWJcMa1srbwujd12u?= =?us-ascii?Q?lt9hzs3IDUZ77dg0sXt8Ayxln+30noF5v8SMDvBOtHZfDpVAEO8a5iKQLMjC?= =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wYLCV2p4O9FBK9hy5iF8=;5:mKhaiaNtjTjyl92B3nHxxfTVyIQqksVTcqr9W+rDtxpWAVhwlB4mnwDXAAWpno+UO466vnhFzKjOaVM0HROcM9e1mik1/zEeczehwKTHOsrtzs84E2Uwlgn0TZeU7yCRYGV7fC2N77P+QVK06Xo4e5QhQHT1cuLRkIFdTfUF6PQ=;24:BGdLcd0myzWmML77nheDL8eK5QbsYB0ykmXHNII7sRnemWTfmtiA0KgRNZfsKOKc+fNLqf6JteCNP4+INQNdrUtDYOp2C3gbScy3bDhC4rg=;7:aDeu8vEfwAyH40d+aMi0x8GYDuNmJsX0Ni6JVYPCNRebcSeVVOPUJxLEYiNBXwWLwVd++c+Fzjk+ODtxuBwykw6AyON+8s1y4kweNyeAIgxkOXHLJtGFoFK+g+2SF2Yr4gegoGyUyoCZoP/dAy1+e5ZYvbAEf/n9PHn9QVxFLCf4Gxhzjol+o5hLNROq3P/XiEuYdzm3QXyiZBuOf8LczMA+v99las79+dN/x3698nqCl7Kf0ZdS3UhU0RlBHoJi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2017 09:49:51.2913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 299cc782-4033-4819-3671-08d536455f3e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3745 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yossef Efraim This patch adds ESN support to IPsec device offload. Adding new xfrm device operation to synchronize device ESN. Signed-off-by: Yossef Efraim --- include/linux/netdevice.h | 1 + include/net/xfrm.h | 12 ++++++++++++ net/xfrm/xfrm_device.c | 4 ++-- net/xfrm/xfrm_replay.c | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7de7656..d4e9198 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -825,6 +825,7 @@ struct xfrmdev_ops { void (*xdo_dev_state_free) (struct xfrm_state *x); bool (*xdo_dev_offload_ok) (struct sk_buff *skb, struct xfrm_state *x); + void (*xdo_dev_state_advance_esn) (struct xfrm_state *x); }; #endif diff --git a/include/net/xfrm.h b/include/net/xfrm.h index dc28a98..372bfcb 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1863,6 +1863,14 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, struct xfrm_user_offload *xuo); bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x); +static inline void xfrm_dev_state_advance_esn(struct xfrm_state *x) +{ + struct xfrm_state_offload *xso = &x->xso; + + if (xso->dev && xso->dev->xfrmdev_ops->xdo_dev_state_advance_esn) + xso->dev->xfrmdev_ops->xdo_dev_state_advance_esn(x); +} + static inline bool xfrm_dst_offload_ok(struct dst_entry *dst) { struct xfrm_state *x = dst->xfrm; @@ -1920,6 +1928,10 @@ static inline bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x return false; } +static inline void xfrm_dev_state_advance_esn(struct xfrm_state *x) +{ +} + static inline bool xfrm_dst_offload_ok(struct dst_entry *dst) { return false; diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c index dc68d9c..fc7e1e44 100644 --- a/net/xfrm/xfrm_device.c +++ b/net/xfrm/xfrm_device.c @@ -65,8 +65,8 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, if (!x->type_offload) return -EINVAL; - /* We don't yet support UDP encapsulation, TFC padding and ESN. */ - if (x->encap || x->tfcpad || (x->props.flags & XFRM_STATE_ESN)) + /* We don't yet support UDP encapsulation and TFC padding. */ + if (x->encap || x->tfcpad) return -EINVAL; dev = dev_get_by_index(net, xuo->ifindex); diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 0250181..1d38c6a 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c @@ -551,6 +551,8 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) bitnr = replay_esn->replay_window - (diff - pos); } + xfrm_dev_state_advance_esn(x); + nr = bitnr >> 5; bitnr = bitnr & 0x1F; replay_esn->bmp[nr] |= (1U << bitnr); -- 2.8.1 From 1585645017933922384@xxx Sat Dec 02 04:28:48 +0000 2017 X-GM-THRID: 1585645017933922384 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread