From patchwork Sat May 23 12:28:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1296692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=tKr65kuc; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49TjMN2RSJz9sSF for ; Sat, 23 May 2020 22:28:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A50D22076E; Sat, 23 May 2020 12:28:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N0qU6K-OeqLF; Sat, 23 May 2020 12:28:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 426B4204F9; Sat, 23 May 2020 12:28:43 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 12D02C0178; Sat, 23 May 2020 12:28:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5E1FEC0178 for ; Sat, 23 May 2020 12:28:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5827B88402 for ; Sat, 23 May 2020 12:28:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QEimrcSXtkso for ; Sat, 23 May 2020 12:28:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id C1954883F5 for ; Sat, 23 May 2020 12:28:40 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id 5so6225473pjd.0 for ; Sat, 23 May 2020 05:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EX9yKn4oBNOiekerYi7DGaGEcNZzT2yRJ/DrBUfULsE=; b=tKr65kuc/s4r+VPseG+NgK2/itfmC7g27lPT3kXBO5Nd1JbMpZeN7KL7+z9izjBdbC WIn/liItWLox6PQGcq9aiJTMO8d++7eGoKWztEDbzvdKOfpGFwJkd/OeJNREUTMymr+h zfCVCW/+X6DtijUtnpA6/5AXsylUIsgrG1wIveQzzt9oL5trSrsm7/N8O4ZZ3O+kMyl4 SzZNBfs7ePt18MIcYaU79boc4Txl8mQtzUXCsvypSuhOTfDxBGK61YoCjoRp4vL74sxm gvwdpP9TeJV2kAFr2q5//lwXNyWX0xru+buhGine5QTAOIgNT/5QwsbBciqelzZEcuOB 3Gng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EX9yKn4oBNOiekerYi7DGaGEcNZzT2yRJ/DrBUfULsE=; b=CA/QVSxL/4o9v0xfAcBoXDsFE0UdrXCL8liccHM2J8uNyeEU7xE5Bb8FbhJah9ce/O YfwJwNV5Pyr1kqcu/oCtrFvtwoYmzMzUHGYrD9EIVtIkWG5RrtVUJb6tEuiosiQf4Rlp KLivrZf9B4n5ElSdZoxfJcNNfOMhJfi0zg77tfUzq/AbTYpcDXgeOyjeeM5jPqYd8fbq sXkO/T3u2Ik9QxpymqQNTLH6WqcKMZmHlldlIwq+bl62+R7GCpsUbht/7v9qzGYqXHtD D5LswQxY5VBUmMQ165AXVzcKun058QkSP/Zx0PoWXl/vQ0da+50NKfXX1ZgYxYGQoUIu 4A7Q== X-Gm-Message-State: AOAM530q85csNis1VOK60NVdYPEoEc/GkDog0hNTreqpXybibPDlE3DR TCmgcPw6Ld7Egcj/xmYcaJE= X-Google-Smtp-Source: ABdhPJyCUgCwmOk2RRjQcY64xPK/Px+5gEab9b6T77uGPjFLNQFyBycDeKl5zz1yo95Imw0FrZIbAw== X-Received: by 2002:a17:90a:49c5:: with SMTP id l5mr10046454pjm.73.1590236920471; Sat, 23 May 2020 05:28:40 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id e5sm9072665pfe.121.2020.05.23.05.28.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 May 2020 05:28:39 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: yliu@fridaylinux.org, i.maximets@ovn.org, blp@ovn.org, u9012063@gmail.com Date: Sat, 23 May 2020 20:28:28 +0800 Message-Id: <20200523122828.54627-2-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20200523122828.54627-1-xiangxia.m.yue@gmail.com> References: <20200523122828.54627-1-xiangxia.m.yue@gmail.com> Cc: dev@openvswitch.org Subject: [ovs-dev] [PATCH 2/2] dpif-netdev: Return error code when no mark available. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang The max number of mark is (UINT32_MAX - 1), that is enough to be used. But theoretically, if there are no mark available, the later different flows will shared the mark INVALID_FLOW_MARK, that may break the function. If there are no available mark to be used, return error code. Cc: Yuanhan Liu Cc: Ian Stokes Cc: Ben Pfaff Cc: William Tu Signed-off-by: Tonghao Zhang --- lib/dpif-netdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 25c4b960857a..a001e5b4ea4a 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2426,6 +2426,7 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload) mark = flow_mark_alloc(); if (mark == INVALID_FLOW_MARK) { VLOG_ERR("Failed to allocate flow mark!\n"); + return -1; } } info.flow_mark = mark;