From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 430AF43C3F; Thu, 29 Feb 2024 18:32:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D1CF42F8B; Thu, 29 Feb 2024 18:32:09 +0100 (CET) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) by mails.dpdk.org (Postfix) with ESMTP id 798CE42F76 for ; Thu, 29 Feb 2024 18:32:07 +0100 (CET) Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7c7db34d162so44873139f.2 for ; Thu, 29 Feb 2024 09:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709227927; x=1709832727; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FUQximORum8BhjyMMC3ErcEcgBw2b5paXd1ZD/Z8r0U=; b=HypURsZgRnP0Lo0Vskvzk6kceoN476EFsiAVdopxShRRniKE/xLMEQmyp4bdmZ2Axv 6ir7vo9SETN2SDApVwoyNhTYGhVk3COr/NG/Fyq9Rcq8RKyYeyToUUcjT8euUg5vUozx dkfgPmOyoZ3iJMRegaQ5lMoV59iC0GOa0l85nvz+wDLvBmtYgXSFKzF4syKeHRZo63sN +CEc2v63Uz/LtXSMLjxoG5H8/Gcnz1ro3gUZH0i0rPAr5w/FCbKpjEyaAPT/p8Qrm61j OdBy2vHxzBgyhuHvLpaeN3ml861tTj3cOwMdo/u964oBiIK49qrxnXiI8H+ZLctJ52ZY reMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709227927; x=1709832727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FUQximORum8BhjyMMC3ErcEcgBw2b5paXd1ZD/Z8r0U=; b=r05+0t+f7IX+ZxhBEFPXAiItGq+Rs3/mbXgU9mkkFjieccVjotlaq46e4GynfKWPTl OmjC7CehWhaEkNJbVhlSntkLx25DWwQ9biftG8l4DVpvf3TylJeY/J7ZoXJtPlhpG3qm 6+qhbsBlJboc3+2MIVTIWjuA4MFOLaaDqgavsKN0v4QF3u2MbI6jfjv82bRMKaEZAx/Q pZOgFw0PkUtM7eVD/w/0qgRM6iXvnsPkE3ABAX+a8W1O9XWNTl/T78Ao0qd7v3cchvwP 37KbdV5UxD4yD1izNZ7tzWvTQKu5yEjH736ylOaWHSrRUD3iBVsH1qxQ/aAyodsnCv1x 2fAw== X-Gm-Message-State: AOJu0YxpAu5hLyYehKCeKy244P1FVp9WkUpqfUGSTkgyD554lI9RIieH ykvscaMT1MjW06RM9OmWLqysMHtw/Ojr/mWrEDNQD3bkFYT231nPEDEOMxDSa2HXgTedNK0AANs v X-Google-Smtp-Source: AGHT+IHigGPwYXFq5fM6SSdb3GYNnb/cBr9P4qNcBcqilkkeWa/HZs+AohOBsElnB/MXAuQZruJpYg== X-Received: by 2002:a05:6e02:1041:b0:365:5dbd:aa34 with SMTP id p1-20020a056e02104100b003655dbdaa34mr2703498ilj.12.1709227926774; Thu, 29 Feb 2024 09:32:06 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id r31-20020a63fc5f000000b005dc3fc53f19sm1584846pgk.7.2024.02.29.09.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:32:05 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Pascal Mazon , Ophir Munk , Olga Shern , Keith Wiles Subject: [PATCH 2/3] net/tap: do not overwrite rte_flow errors Date: Thu, 29 Feb 2024 09:31:07 -0800 Message-ID: <20240229173154.121491-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229173154.121491-1-stephen@networkplumber.org> References: <20240229173154.121491-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org All flow errors were ending up being reported as not supported, even when the error path was previously setting a valid and better error message. Example, asking for a non-existent queue in flow. Before: testpmd> flow create 0 ingress pattern eth src is 06:05:04:03:02:01 \ / end actions queue index 12 / end port_flow_complain(): Caught PMD error type 16 (specific action): cause: 0x7fffc46c1e18, action not supported: Operation not supported After: testpmd> flow create 0 ingress pattern eth src is 06:05:04:03:02:01 \ / end actions queue index 12 / end port_flow_complain(): Caught PMD error type 16 (specific action): cause: 0x7fffa54e1d88, queue index out of range: Numerical result out of range Fixes: f46900d03823 ("net/tap: fix flow and port commands") Fixes: de96fe68ae95 ("net/tap: add basic flow API patterns and actions") Signed-off-by: Stephen Hemminger --- drivers/net/tap/tap_flow.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index ed4d42f92f9f..5b0fee906493 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -1082,8 +1082,11 @@ priv_flow_process(struct pmd_internals *pmd, } /* use flower filter type */ tap_nlattr_add(&flow->msg.nh, TCA_KIND, sizeof("flower"), "flower"); - if (tap_nlattr_nested_start(&flow->msg, TCA_OPTIONS) < 0) - goto exit_item_not_supported; + if (tap_nlattr_nested_start(&flow->msg, TCA_OPTIONS) < 0) { + rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_ACTION, + actions, "could not allocated netlink msg"); + goto exit_return_error; + } } for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) { const struct tap_flow_items *token = NULL; @@ -1199,9 +1202,12 @@ priv_flow_process(struct pmd_internals *pmd, if (action) goto exit_action_not_supported; action = 1; - if (!queue || - (queue->index > pmd->dev->data->nb_rx_queues - 1)) - goto exit_action_not_supported; + if (queue->index >= pmd->dev->data->nb_rx_queues) { + rte_flow_error_set(error, ERANGE, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "queue index out of range"); + goto exit_return_error; + } if (flow) { struct action_data adata = { .id = "skbedit", @@ -1227,7 +1233,7 @@ priv_flow_process(struct pmd_internals *pmd, if (!pmd->rss_enabled) { err = rss_enable(pmd, attr, error); if (err) - goto exit_action_not_supported; + goto exit_return_error; } if (flow) err = rss_add_actions(flow, pmd, rss, error); @@ -1235,7 +1241,7 @@ priv_flow_process(struct pmd_internals *pmd, goto exit_action_not_supported; } if (err) - goto exit_action_not_supported; + goto exit_return_error; } /* When fate is unknown, drop traffic. */ if (!action) { @@ -1258,6 +1264,7 @@ priv_flow_process(struct pmd_internals *pmd, exit_action_not_supported: rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, actions, "action not supported"); +exit_return_error: return -rte_errno; } -- 2.43.0