From patchwork Thu Mar 26 20:45:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1262289 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=EAzMmltU; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48pH8j6Q2kz9sR4 for ; Fri, 27 Mar 2020 07:46:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727636AbgCZUqp (ORCPT ); Thu, 26 Mar 2020 16:46:45 -0400 Received: from mail-eopbgr80041.outbound.protection.outlook.com ([40.107.8.41]:8149 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727509AbgCZUqo (ORCPT ); Thu, 26 Mar 2020 16:46:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L9175vsZL/kPZF6j+wKoo/8t3/pZoM+bV++MtnEdIOTnvkh/PEYqwiAio29KeBVwnFKT+y6jYQraig/GA1vFaz4166f1gfod/fG/W1bxuJJzr17Kkgqir1a3MEmavpSF0ATnzPjZjXdsOuVcP71/x96gTireI+SDd6XscWLcJqqkPA5SL8rDnCwGXRr/aOS3/KZLJ38icZH5uBVxErjmwBloZ62+L9JHIdtNAbxo7bUQpm+52Pl2ffihuKmb60WiDZeT5KJk8dDwxOL5Y/35Mg5rGyD9YMF3K72UKnbaZwgrsXkCbq7cMQRbIyeL4m8RvIl54XEuUJ+PcZnkMfKuOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wVnC72YRlrPPKyjtFAsIfR4noWvq9jwqBYXSa6eFYg4=; b=h8y3h4Uz5mmk4lDQa8w1HkEQMkdoz+w9kaIltbtgoSv5pH0IVCowFB7KmxYz71fWbW1dsyzHNErVLLrfUL0QQlwc50EQe+/+QEcoOov8Ux+jSdCqHxuEcC/05xiKCl4MH077cqg6PkWCLaYVFfMkxtuYralVRMRafjJBh/JTA+nNNOEZ9iXijlQ5zO80tghrU/AZxOkZrU8MTAsLeXTHUbu64OFhsMSLz61dCEhiEeCTv8sXeVR9vvTm3zN2eC8Dhpy6zS2BACtbNPlhQ2hpNikjdfytWwasOAIHHqlYYgkN+WkuFJURXIbYbqzw7R3E0Fa6cB7YCiLNwQLAXJCv0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=wVnC72YRlrPPKyjtFAsIfR4noWvq9jwqBYXSa6eFYg4=; b=EAzMmltU4khnxJmlXoa+34m86TNJZm6xKlZ4khDi/SDYuCX74MT+y7CtlQC/Em2ZMeZCBtdn7/sCPyu/itWdJRHoXBvxgHyD06LjPiyls+6ccIT1bL/coxT/0FltL70yZ+VsN7IEktGoCtdATczVqhomVQgjnKeJwicJF3REYL4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from HE1PR05MB4746.eurprd05.prod.outlook.com (20.176.168.150) by AM6SPR01MB0020.eurprd05.prod.outlook.com (20.177.39.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.18; Thu, 26 Mar 2020 20:46:27 +0000 Received: from HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b]) by HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b%6]) with mapi id 15.20.2835.023; Thu, 26 Mar 2020 20:46:27 +0000 From: Petr Machata To: netdev@vger.kernel.org Cc: David Miller , Petr Machata , idosch@mellanox.com, jiri@mellanox.com, alexpe@mellanox.com Subject: [PATCH net-next 1/3] sched: act_skbedit: Implement stats_update callback Date: Thu, 26 Mar 2020 22:45:55 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: PR0P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::31) To HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by PR0P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19 via Frontend Transport; Thu, 26 Mar 2020 20:46:25 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e7529450-9c85-4201-1eac-08d7d1c6c102 X-MS-TrafficTypeDiagnostic: AM6SPR01MB0020:|AM6SPR01MB0020: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 0354B4BED2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR05MB4746.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(39860400002)(396003)(136003)(376002)(366004)(26005)(66476007)(86362001)(107886003)(54906003)(16526019)(956004)(186003)(2616005)(5660300002)(66556008)(66946007)(4326008)(316002)(52116002)(8936002)(6506007)(8676002)(6512007)(478600001)(6486002)(2906002)(36756003)(6916009)(81166006)(81156014)(6666004); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WPu02kQ00Njwm4Z1mOTgzY6SFmIDBNOsrFK/8ISb2L2yKchO+Xr3qwHUYrBZFtOQUYHetMuJiF2sI2QPd+pQS1RbxtNhP5w2s8o1fLhw2yZzmVjLhrzhWrHQAMe/OvBPdQ2R485dv1SLG0zZJEWn/P6WkszX2w125RzGqloGzMj+eMj4N/IShqHPRyas3TX50i/IA/OIHG1aeUAhmqNmrwIxfIqO5cmvMGR17XGp6lDGf3pvQKXsaUSGlpzwPxXv/KtP+6rbOOqrnT2HkRrfiHdBHdi6A0UvjYJ0znK2GI29xtSwPrUGUYY3RAxk8vBBEuGA1Yo6Uyo37wUNtivKwZmC/29skRbr6FHyuxmkJVKaHUsHu88E4Kym4ziuN6xZH88yAuKXvxRQjbCBZaBtCLgNCuaamSxkkgMutacWIKy9Aux6Zfuzxqs0B8+1NE0w X-MS-Exchange-AntiSpam-MessageData: 3uwNT57Ysm7jmJUaXazUbrb3eRkHc2PHt/K8JjLzEwy6wCaTdSHEjZdmTHXqmJJCxSzFXKNcVRY7+5SAKQ0vHGGj8dJUMBfM1Ff0Y31y5PWLotlgW9PjuvpTUkqlL+tw10k5JSvYlqwumke7jZ3a7Q== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7529450-9c85-4201-1eac-08d7d1c6c102 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2020 20:46:27.1274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1sPmKsRFPiLf0KUfW5QU4WwqrMSfAc20gKuQ2IpRTf3o5VzPRyeLABLUmxux/PWiro44/DN1VSOOOdsx1IrENA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6SPR01MB0020 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Implement this callback in order to get the offloaded stats added to the kernel stats. Reported-by: Alexander Petrovskiy Signed-off-by: Petr Machata --- net/sched/act_skbedit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index e857424c387c..b125b2be4467 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -73,6 +73,16 @@ static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a, return TC_ACT_SHOT; } +static void tcf_skbedit_stats_update(struct tc_action *a, u64 bytes, + u32 packets, u64 lastuse, bool hw) +{ + struct tcf_skbedit *d = to_skbedit(a); + struct tcf_t *tm = &d->tcf_tm; + + tcf_action_update_stats(a, bytes, packets, false, hw); + tm->lastuse = max_t(u64, tm->lastuse, lastuse); +} + static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = { [TCA_SKBEDIT_PARMS] = { .len = sizeof(struct tc_skbedit) }, [TCA_SKBEDIT_PRIORITY] = { .len = sizeof(u32) }, @@ -323,6 +333,7 @@ static struct tc_action_ops act_skbedit_ops = { .id = TCA_ID_SKBEDIT, .owner = THIS_MODULE, .act = tcf_skbedit_act, + .stats_update = tcf_skbedit_stats_update, .dump = tcf_skbedit_dump, .init = tcf_skbedit_init, .cleanup = tcf_skbedit_cleanup, From patchwork Thu Mar 26 20:45:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1262290 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=mqw2h5k/; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48pH8n2Mqgz9sR4 for ; Fri, 27 Mar 2020 07:46:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727655AbgCZUqs (ORCPT ); Thu, 26 Mar 2020 16:46:48 -0400 Received: from mail-eopbgr80041.outbound.protection.outlook.com ([40.107.8.41]:8149 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727611AbgCZUqs (ORCPT ); Thu, 26 Mar 2020 16:46:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJVbH4oH8ERzKrigwj7QBSHPQBhZ1U30rNkvSemjRcKJzMpUwF9JRmPwlTjQ+1ddabqwyCSG7acQsZmQ1Faa/dTEITN0pTUs+toBX5h1+DgR3o9ALnGXT1aYuRyZpUbfQ/Zv4+6YUw2oqlpeq8QtKL2rW45Is/NUViEVYfbNmOHiM/fFXyoHBr5LSyb0Jb8t/BbNSTd+NiM3l/FgxHXAhsI1E4GmNbjhKLBJYxYmp4kHeTloXDwtxfBAOjrPjng3fcZZFGBBZAE6M9JmJnlGiXU6dWYjqIkv8pI8/VZMp73FRBk47OloLlS/jiUvDdHNYYSSwdmHZcbxHKXCGirMJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=82KLTuZSw/eYa72r16IMQfWGtoIdHFC/iGzQE3z1X8A=; b=RsnyGM1ojEthH2OR8NNl6YSSQVCt1FXp85fwMhSCGDJOxB5lIoRM0FLRmYbdkhEW3KYBdV2zoiA4zr+lMXHO81kIDXXP8D2PSeiCa7zJQoOPjxUtu/yF9Cb8tF19AqxJIXbCFxNZx5/nqqfrk1v5dTnT1RK4xzxEfvm4PCnxSYe3zqdKod1Yt1c6UpQndT0MXQFkqUhUwIJbXoJF8tNupESubSKhtoiBPQD0QNAflmm/R7lTdEewwUU+RPSlEhUQw5Iyz/nqjZP4rMYTetUl4inGir92CuOod4X9vkHM+cHL/SVU2JeG4Ik31GpfVvAq2FA16+6MAi858J/HUqxnCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=82KLTuZSw/eYa72r16IMQfWGtoIdHFC/iGzQE3z1X8A=; b=mqw2h5k/AGg6x1wNSXvxJJ8bsF/nhfnktsNXxQBv/9c+N0yxJIPHWPnhUquSxAS4btqiWunHlchSfThdxYIke5gcAPu/hrDGaU8aD7hjqYSqer/2BELBJvk2kpMg9t5J4gJ23DgR/jMtncgwaD5nA3+HrVikxt1o2NGTFw7zjk0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from HE1PR05MB4746.eurprd05.prod.outlook.com (20.176.168.150) by AM6SPR01MB0020.eurprd05.prod.outlook.com (20.177.39.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.18; Thu, 26 Mar 2020 20:46:28 +0000 Received: from HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b]) by HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b%6]) with mapi id 15.20.2835.023; Thu, 26 Mar 2020 20:46:28 +0000 From: Petr Machata To: netdev@vger.kernel.org Cc: David Miller , Petr Machata , idosch@mellanox.com, jiri@mellanox.com, alexpe@mellanox.com Subject: [PATCH net-next 2/3] sched: act_pedit: Implement stats_update callback Date: Thu, 26 Mar 2020 22:45:56 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: PR0P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::31) To HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by PR0P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19 via Frontend Transport; Thu, 26 Mar 2020 20:46:27 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d86caf4b-64b5-455e-9643-08d7d1c6c1d2 X-MS-TrafficTypeDiagnostic: AM6SPR01MB0020:|AM6SPR01MB0020: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 0354B4BED2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR05MB4746.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(39860400002)(396003)(136003)(376002)(366004)(26005)(66476007)(86362001)(107886003)(54906003)(16526019)(956004)(186003)(2616005)(5660300002)(66556008)(66946007)(4326008)(316002)(52116002)(8936002)(6506007)(8676002)(6512007)(478600001)(6486002)(2906002)(36756003)(6916009)(81166006)(81156014)(6666004); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Om00aZblELixTiGQ7QND/l4e/4Qd7fO6/aLQm0QoFwHqscdVO6dA+0FQeTbiqQbySN92vlOtSjvbaVNp39vKWcQO73hwZpLIud6AkX4vkogi59amKVAfFVfdOXE7oa8dQZto2Zc+dblc6d5H4VmwMRk/c6QLBSSeowg/l2GbG7fqhoZeFHWsrIZgUrueq+qmU0cE211o6FpG3fOeeout3hdOBYvfd5lEkM6hKp91jh4dHsvcuifkceX0K382YeMt3Aw/ivlWV6AdfGkAF3iURnOgGlRAyxGLt+b540Aybv5M2ZrbBYQcvgHgGSR6R4MrIp3dnakRSlYdiD2v0ID1L9QM+3djbV192yldgPn77w9ktaflQEguVVw253tOfk0od4x2LGqcWLqmJ1d2ya+srXDDzY78BgiIoFG1E1rdvJz6OodSegqiqbyLOGcNBroI X-MS-Exchange-AntiSpam-MessageData: 7eHRkgSdUzHGW4R0udb2tgYOd5wNuX+weymllm82J5hmaABCX/pgJhGk9+Q44AFtLHusxBEROniDJ6qYxUp2uZcJDbeTn+T3EtGLKjFBev6ifPQ8D8vSZU2mUKWP89892UCTnklwuqhSo0WGd/uSrg== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d86caf4b-64b5-455e-9643-08d7d1c6c1d2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2020 20:46:28.4286 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bq+rWTd4MpYZPpZrnQVJw8wgJOBLmpVAXMI2JQJ7iBDEC0xap6SJ2xC/LK/rV4Z/8OtRT5u6mMjVMW1q3/njNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6SPR01MB0020 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Implement this callback in order to get the offloaded stats added to the kernel stats. Reported-by: Alexander Petrovskiy Signed-off-by: Petr Machata --- net/sched/act_pedit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 3ad718576304..d41d6200d9de 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -409,6 +409,16 @@ static int tcf_pedit_act(struct sk_buff *skb, const struct tc_action *a, return p->tcf_action; } +static void tcf_pedit_stats_update(struct tc_action *a, u64 bytes, u32 packets, + u64 lastuse, bool hw) +{ + struct tcf_pedit *d = to_pedit(a); + struct tcf_t *tm = &d->tcf_tm; + + tcf_action_update_stats(a, bytes, packets, false, hw); + tm->lastuse = max_t(u64, tm->lastuse, lastuse); +} + static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) { @@ -485,6 +495,7 @@ static struct tc_action_ops act_pedit_ops = { .id = TCA_ID_PEDIT, .owner = THIS_MODULE, .act = tcf_pedit_act, + .stats_update = tcf_pedit_stats_update, .dump = tcf_pedit_dump, .cleanup = tcf_pedit_cleanup, .init = tcf_pedit_init, From patchwork Thu Mar 26 20:45:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1262288 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=rAGBcCYH; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48pH8V5PgCz9sR4 for ; Fri, 27 Mar 2020 07:46:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbgCZUqe (ORCPT ); Thu, 26 Mar 2020 16:46:34 -0400 Received: from mail-eopbgr60084.outbound.protection.outlook.com ([40.107.6.84]:37759 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726034AbgCZUqd (ORCPT ); Thu, 26 Mar 2020 16:46:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i/HQ5labq36ynIb+wdtDXhxHmwO8kDY1XvTSeNicdoK7bLUqG+g+Sc2HvgBejzniV5KSG7qyGE6JoAnED2biH5kXW2wUv7Vae1o304zH7VejQV5pArsVKM+InkRdu7uj+KeVnIJ2BH9WYIdsZXnpwtV+uQfJwxmcxr8RV/lpTA+x0JLhYPdbVqlE6zr8t7Xr6VTZl8Y2HGRKJdvBkQ+jvFKEkwOST+ne6XNZPir6dy8D4U1pQ4J8MUd2q9NXjgi4LBro1MBrRm/s/vQ2Jtiu7Y23tZYrwYHbPeeBZep7OFonSpUIcJnvpVww156wUF1IFFCGfLBICcMo7kha9EoYVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=idzH4qfUzNZqbA72vNJLX2Ci023acYLLJZH6FfZfV3k=; b=FhvqfKzuDszRRauuoD76p14ZRwLGGBhY8eJFVCOvH2z0wlsyTVJcyMXdw+z+iKJ5xHt1JjoY0JZMxY34ESBHtM85Ml8fKUeOmgvMdRZhA2Hs5ZQad/kVLeK2CD+/O3Yzgzf3os/KguknZY4DFSckip1+kvnvF6dEF8iNdGv7WhyK697uo7jcweeYOLQWkJtXChFrXlju1NzZdHI82cpyyz18stxkWWEFFIo6Oppu/IjkdilxPWs3ijWARGqsnJrYAlw/kLUpW484F7SpmIU2BfCtF3EQUgBAwIy97UoI1/a25zAYKlHFKj8+9dCVuoZGf/TvHHbGjnXQUgS4LXWWjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=idzH4qfUzNZqbA72vNJLX2Ci023acYLLJZH6FfZfV3k=; b=rAGBcCYHkiYrjTFDmw0J62Gj9XNEB1NiaL6znp+gho+TbqgkvNwjwcw4El+xFua0Y65GGzcKjx267e/o9IZKwJuxpqkDUrifnXUI1hf+sQ4NdWhmYf1YABHRiJYF89HP9/RPncWefELBMLeawCmn466dHpzzdG1j9O3SRu6wRkE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from HE1PR05MB4746.eurprd05.prod.outlook.com (20.176.168.150) by HE1PR05MB3260.eurprd05.prod.outlook.com (10.170.243.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Thu, 26 Mar 2020 20:46:29 +0000 Received: from HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b]) by HE1PR05MB4746.eurprd05.prod.outlook.com ([fe80::e9a8:7b1c:f82a:865b%6]) with mapi id 15.20.2835.023; Thu, 26 Mar 2020 20:46:29 +0000 From: Petr Machata To: netdev@vger.kernel.org Cc: David Miller , Petr Machata , idosch@mellanox.com, jiri@mellanox.com, alexpe@mellanox.com Subject: [PATCH net-next 3/3] selftests: skbedit_priority: Test counters at the skbedit rule Date: Thu, 26 Mar 2020 22:45:57 +0200 Message-Id: <504a9e0a34dff3fc43296db70e593968cbc5a4de.1585255467.git.petrm@mellanox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: PR0P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::31) To HE1PR05MB4746.eurprd05.prod.outlook.com (2603:10a6:7:a3::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dev-r-vrt-156.mtr.labs.mlnx (37.142.13.130) by PR0P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19 via Frontend Transport; Thu, 26 Mar 2020 20:46:28 +0000 X-Mailer: git-send-email 2.20.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 82e66071-21b5-4cf6-c8a8-08d7d1c6c29e X-MS-TrafficTypeDiagnostic: HE1PR05MB3260:|HE1PR05MB3260: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 0354B4BED2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR05MB4746.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(396003)(346002)(136003)(376002)(39860400002)(366004)(2616005)(478600001)(36756003)(956004)(6506007)(16526019)(52116002)(4326008)(107886003)(26005)(186003)(8936002)(6486002)(2906002)(66476007)(8676002)(316002)(86362001)(6666004)(81166006)(81156014)(6916009)(54906003)(5660300002)(6512007)(66946007)(66556008); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ETLaMjKXsqj29IdP4nAVDldTcwsONAWr369kR1y02DTldtsKTRjc6VyM3PZX/i0rzcw4E50DvWzRtMBM+syohu1EBfeHJ38r+ITr4RGNkngSNsJmCZ3lcgwjNSsmJ3nCLbKWfWHIKq6HOJbYL8xohRlLY2Z4ipuEaHjwx7XJUpcVPs1ExwCPjYTvaRxuCRgw3e0xAy1mRt5qWK7LkAWObKUn2IA0C5CfHC4Y4WS67ABi1pQ7bAqN5DTlj0p4XT9tKM9E+lwuf3Q7PgMTrBLBmkEbbXJOLLX3efrchinI1DVm2CTlVJRqK1y6fTkUZSa+Ed7fWSOKRHtn+jQ37no+fyh/qTpar7w+lGsYPfha6sJ7q9eyjVeQpKvfH3CWwk2ZCYBLfivYiJcVF7zFqX0G1S4CWe2fbSFf2SJqM6OsEXd+TMLWx23E1A1bY2DZZCn2 X-MS-Exchange-AntiSpam-MessageData: RJYu1MapQc+Au1ulXTD8PirGQ6DtiGIY/LS6WU1n8bd2IQSzsXv/L12/4IWp7/sLJ4C9sOQeXpe5V3ctK7v7zGAakRZhjVjYaBOyUip66qNCI6fDi7JGYop7CCeLlR8mZeWjqBrpfyLajSatt3uHGA== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82e66071-21b5-4cf6-c8a8-08d7d1c6c29e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2020 20:46:29.8228 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GuAqnB7R2kZRsmtL4aC2RVF7HygqROd6zzCmUnBP3brYKvRi7wUECrkAmpsNJZEfHe39C9XE7bBoF67NA2/kvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3260 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently the test checks the observable effect of skbedit priority: queueing of packets at the correct qdisc band. It therefore misses the fact that the counters for offloaded rules are not updated. Add an extra check for the counter. Signed-off-by: Petr Machata --- .../testing/selftests/net/forwarding/skbedit_priority.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/skbedit_priority.sh b/tools/testing/selftests/net/forwarding/skbedit_priority.sh index 0e7693297765..e3bd8a6bb8b4 100755 --- a/tools/testing/selftests/net/forwarding/skbedit_priority.sh +++ b/tools/testing/selftests/net/forwarding/skbedit_priority.sh @@ -120,14 +120,19 @@ test_skbedit_priority_one() flower action skbedit priority $prio local pkt0=$(qdisc_parent_stats_get $swp2 $classid .packets) + local pkt2=$(tc_rule_handle_stats_get "$locus" 101) $MZ $h1 -t udp "sp=54321,dp=12345" -c 10 -d 20msec -p 100 \ -a own -b $h2mac -A 192.0.2.1 -B 192.0.2.2 -q + local pkt1 pkt1=$(busywait "$HIT_TIMEOUT" until_counter_is ">= $((pkt0 + 10))" \ qdisc_parent_stats_get $swp2 $classid .packets) + check_err $? "Expected to get 10 packets on class $classid, but got $((pkt1 - pkt0))." + + local pkt3=$(tc_rule_handle_stats_get "$locus" 101) + ((pkt3 >= pkt2 + 10)) + check_err $? "Expected to get 10 packets on skbedit rule but got $((pkt3 - pkt2))." - check_err $? "Expected to get 10 packets on class $classid, but got -$((pkt1 - pkt0))." log_test "$locus skbedit priority $prio -> classid $classid" tc filter del $locus pref 1