From patchwork Tue Mar 14 08:58:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13173926 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A8F8C6FD1C for ; Tue, 14 Mar 2023 08:59:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230452AbjCNI7e (ORCPT ); Tue, 14 Mar 2023 04:59:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjCNI7X (ORCPT ); Tue, 14 Mar 2023 04:59:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7957E94754 for ; Tue, 14 Mar 2023 01:59:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A96FB818A1 for ; Tue, 14 Mar 2023 08:59:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E849C4339C; Tue, 14 Mar 2023 08:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678784356; bh=sxKZFjeDSMLz1eY+eCxOildHyrYZLdZ7lMOpepBIMds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=st48crY+tQ9oEZoANIlE7BwpHwZ8LS3D82DAhD6ioSrabywG0h2MPk7xx517Vm+jq sjK9KWBlc2FuxoCUk143XNoDdUhN1n2ogv1Kw6gE2lM3L6zri5tCBDGYxI2FP5utmj 6vwet/fL/XERAW1ei7hLAgz91CGo3zkuCs9DDYHPPCdSyEdpOmW/9jd2oPz6ukSb6M pT50XbuaWVdY3MzHiMuYd/vLnnvzOjr8SuuaJolK+MS/ihTyCm626kqDwWO8o9MuDX gkYuw5Acy026sC6cWFc5ns19EOrqjwEU5qxLNBZIB8Iaj/B1sEIGYCEJCrY6Ciu4MR MdFfPWIFwo2qA== From: Leon Romanovsky To: Steffen Klassert Cc: Raed Salem , "David S. Miller" , Eric Dumazet , Herbert Xu , Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni , Paul Blakey , Saeed Mahameed Subject: [PATCH xfrm-next 5/9] xfrm: copy_to_user_state fetch offloaded SA packets/bytes statistics Date: Tue, 14 Mar 2023 10:58:40 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Raed Salem Both in RX and TX, the traffic that performs IPsec packet offload transformation is accounted by HW only. Consequently, the HW should be queried for packets/bytes statistics when user asks for such transformation data. Signed-off-by: Raed Salem Signed-off-by: Leon Romanovsky Acked-by: Steffen Klassert --- net/xfrm/xfrm_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index cf5172d4ce68..5eee905b2450 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -901,6 +901,8 @@ static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) memcpy(&p->id, &x->id, sizeof(p->id)); memcpy(&p->sel, &x->sel, sizeof(p->sel)); memcpy(&p->lft, &x->lft, sizeof(p->lft)); + if (x->xso.dev) + xfrm_dev_state_update_curlft(x); memcpy(&p->curlft, &x->curlft, sizeof(p->curlft)); put_unaligned(x->stats.replay_window, &p->stats.replay_window); put_unaligned(x->stats.replay, &p->stats.replay);