From patchwork Fri Aug 11 14:12:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 13350953 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73C1B63B1 for ; Fri, 11 Aug 2023 14:13:34 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A462FE65 for ; Fri, 11 Aug 2023 07:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691763213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7kMu62DxIGlyY+2w5uFs/bD7dgia+F8JpXv/std8jKE=; b=ZYtzUuM19chlbKmlNJnNwEo787CmB9kQyQ5h1b5phfGqA67RJ8XryYX2qE3RihlYSibij5 UlOpV+zGhXKMefXplqeY+Z0fHNBlHToz4pgcHrtnRYSKvCW1lqCW857tmtWYtWA/ha7Ha1 QcyD7WFMV0O5dnUOXcsHuDr5hHLBT9U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-384-QjhgupXnM2WMJUcF9TAT_A-1; Fri, 11 Aug 2023 10:13:28 -0400 X-MC-Unique: QjhgupXnM2WMJUcF9TAT_A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C69231021E15; Fri, 11 Aug 2023 14:13:27 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2BA01121314; Fri, 11 Aug 2023 14:13:26 +0000 (UTC) From: Adrian Moreno To: netdev@vger.kernel.org Cc: Adrian Moreno , aconole@redhat.com, i.maximets@ovn.org, eric@garver.life, dev@openvswitch.org Subject: [net-next v5 4/7] net: openvswitch: add meter drop reason Date: Fri, 11 Aug 2023 16:12:51 +0200 Message-ID: <20230811141255.4103827-5-amorenoz@redhat.com> In-Reply-To: <20230811141255.4103827-1-amorenoz@redhat.com> References: <20230811141255.4103827-1-amorenoz@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org By using an independent drop reason it makes it easy to distinguish between QoS-triggered or flow-triggered drop. Acked-by: Aaron Conole Signed-off-by: Adrian Moreno --- net/openvswitch/actions.c | 2 +- net/openvswitch/drop.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index e188f32ea96f..122211478606 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -1454,7 +1454,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, case OVS_ACTION_ATTR_METER: if (ovs_meter_execute(dp, skb, key, nla_get_u32(a))) { - consume_skb(skb); + ovs_kfree_skb_reason(skb, OVS_DROP_METER); return 0; } break; diff --git a/net/openvswitch/drop.h b/net/openvswitch/drop.h index 22e66d28c0ca..a35e63d71094 100644 --- a/net/openvswitch/drop.h +++ b/net/openvswitch/drop.h @@ -13,6 +13,7 @@ R(OVS_DROP_ACTION_ERROR) \ R(OVS_DROP_EXPLICIT) \ R(OVS_DROP_EXPLICIT_WITH_ERROR) \ + R(OVS_DROP_METER) \ /* deliberate comment for trailing \ */ enum ovs_drop_reason {