From patchwork Fri May 3 10:55:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13652627 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 4FD3514A4E9; Fri, 3 May 2024 10:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733735; cv=none; b=rX8e1XQ4itGkPbnaz7W7SU4MsMDse8doUSIUz5/DxcSQczV8LiQamYdXYnieCpuh1Z0bkBXajV3xrHuNzAyCk+voYIX2RYMKtmlNRSFMo6gd//9/kHAaJTXIn0gOFYe0XC0LvXBBCKOwXZTU2+pCFf+vF70PB2kmMpJqK8LLgNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733735; c=relaxed/simple; bh=M3HQs9C2Rd0Wt95wYa+Q8dqxkvEUKVv2uyT/x8WU/7o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ttn79z0Cnqm6g0qZWKdJJ0n7TaenuNKi+FmjA2tpAa6HafYm9ddaSpJWqucs2yMCvUX4xVcvbJkYm/9zlmRDarScKsnXM838ZemSqniN6FDWfBPqRvHQyoa7hV3vpFgMvqdlS/t8Ubtvb051xz0nlJdRd9pW2meWLPHZFQGZDzU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=i7WG1q8D; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="i7WG1q8D" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 90545600A5; Fri, 3 May 2024 10:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1714733723; bh=M3HQs9C2Rd0Wt95wYa+Q8dqxkvEUKVv2uyT/x8WU/7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i7WG1q8D9sBq5kFC5O8t04v5P2LMKgg0Xh3jz7cSoTls24QS3pnV1IHoNYmDbX0Br yhAlhrU1tp856DC37dMBjU9nnSFNF35I29dnk5WecqHwyHCj2DKTbJs98NenHQl1dO K0eugXx7qZjR3tJwRMYAHk/gRWEL+oWy48K00TGzZ8wNDlBybGsQd6AkhPQXSBOnu4 tirkQ9dxZCTg0K6186P16Hl5TtgGmcB7s79GSRqj9AwHn05eAukikmsSx9MSJk1Y9f cg+WBjYxx5ErfHLcm2OZK1QAb1EiW/+SiBTWwZkitX43/umMt5QuKsA88P70vM36FM dQNPXW5NF11Gw== Received: by x201s (Postfix, from userid 1000) id 012F121BB70; Fri, 03 May 2024 10:55:06 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Manish Chopra Subject: [PATCH net-next 1/3] net: qede: use return from qede_parse_actions() for flow_spec Date: Fri, 3 May 2024 10:55:01 +0000 Message-ID: <20240503105505.839342-2-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240503105505.839342-1-ast@fiberby.net> References: <20240503105505.839342-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In qede_flow_spec_to_rule(), when calling qede_parse_actions() then the return code was only used for a non-zero check, and then -EINVAL was returned. qede_parse_actions() can currently fail with: * -EINVAL * -EOPNOTSUPP Commit 319a1d19471e ("flow_offload: check for basic action hw stats type") broke the implicit assumption that it could only fail with -EINVAL, by changing it to return -EOPNOTSUPP, when hardware stats are requested. However AFAICT it's not possible to trigger qede_parse_actions() to return -EOPNOTSUPP, when called from qede_flow_spec_to_rule(), as hardware stats can't be requested by ethtool_rx_flow_rule_create(). This patch changes qede_flow_spec_to_rule() to use the actual return code from qede_parse_actions(), so it's no longer assumed that all errors are -EINVAL. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Simon Horman --- drivers/net/ethernet/qlogic/qede/qede_filter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index cb6b33a228ea..d5ca4bf6dba5 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -1943,6 +1943,8 @@ static int qede_flow_spec_validate(struct qede_dev *edev, struct qede_arfs_tuple *t, __u32 location) { + int err; + if (location >= QEDE_RFS_MAX_FLTR) { DP_INFO(edev, "Location out-of-bounds\n"); return -EINVAL; @@ -1963,8 +1965,9 @@ static int qede_flow_spec_validate(struct qede_dev *edev, return -EINVAL; } - if (qede_parse_actions(edev, flow_action, NULL)) - return -EINVAL; + err = qede_parse_actions(edev, flow_action, NULL); + if (err) + return err; return 0; } From patchwork Fri May 3 10:55:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13652626 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 4FDCF150984; Fri, 3 May 2024 10:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733735; cv=none; b=oR3ipcwj6QpIYed+1QssOCDUmec7ufTEgsZQZ+v6LoLRAUTZL/jt2V3KSYxO5SI4emFYSVkiAf2gUgxpwKdA26QYfyk7faK7vKOPvcEepmRTqRrSrVfXwBw9/0quavv6KkF0QV3r0ClXuZIbONdkTu3S9sUD7GuMhWUKgaXB6nU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733735; c=relaxed/simple; bh=S7EjJzKWts/3lIkCKkOS7cqWMaPmFMhdsePJ8a3+zl4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jcaK4+CcJhNjKHhN0Wl+OA+9hFTbmiNS3lpWhIc1d48wj/Yat6DvEO7TB2G83NFjHiDds1OLo4BfCVdlDAeYsjybaw04w0V1oHoHxOeqm5BhathNW1pz1U4V+C/znOouPNPHZKXbUsLXvfPoZNevUpGw1CmpJ3bvzRgB4eYt2mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=v78ztFAp; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="v78ztFAp" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 98281600A9; Fri, 3 May 2024 10:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1714733723; bh=S7EjJzKWts/3lIkCKkOS7cqWMaPmFMhdsePJ8a3+zl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v78ztFApfZoFHIOBiMthKWcZ/M1ZLSifn8R00B1zO+p15HYJPZQRkvCzs+iRJP+wo AsFPtP3mkIvHmbFVx2IkqqTWTU2cShOyl/C71tKCkMsu93pYy6CuHbJ9xTaspABX3b NP0raoPpwE02tzbfCKfwp27ki27AEGu18r8Ij1i7djgpvlYhRDfGFLQ8r1l48z3cvq nYRqnY5wAA1nHDE1UIIUOUQcaQz0vWzM272yk6TQ2j5Ej6JKQ/vXj8tc3JN+qDm83K qobFHOiYaQTR6M3uO9yBXQIqsCh+OmKQNEywfAxthjRaMq3ArCSKnbinJTHn+pZP3Y lH6hkbs9zR3vA== Received: by x201s (Postfix, from userid 1000) id 0AB2A21BB72; Fri, 03 May 2024 10:55:11 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Manish Chopra Subject: [PATCH net-next 2/3] net: qede: use return from qede_flow_spec_validate_unused() Date: Fri, 3 May 2024 10:55:02 +0000 Message-ID: <20240503105505.839342-3-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240503105505.839342-1-ast@fiberby.net> References: <20240503105505.839342-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org When calling qede_flow_spec_validate_unused() then the return code was only used for a non-zero check, and then -EOPNOTSUPP was returned. qede_flow_spec_validate_unused() can currently fail with: * -EOPNOTSUPP This patch changes qede_flow_spec_to_rule() to use the actual return code from qede_flow_spec_validate_unused(), so it's no longer assumed that all errors are -EOPNOTSUPP. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Simon Horman --- drivers/net/ethernet/qlogic/qede/qede_filter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index d5ca4bf6dba5..07af0464eb1e 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -1979,10 +1979,11 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev, struct ethtool_rx_flow_spec_input input = {}; struct ethtool_rx_flow_rule *flow; __be16 proto; - int err = 0; + int err; - if (qede_flow_spec_validate_unused(edev, fs)) - return -EOPNOTSUPP; + err = qede_flow_spec_validate_unused(edev, fs); + if (err) + return err; switch ((fs->flow_type & ~FLOW_EXT)) { case TCP_V4_FLOW: From patchwork Fri May 3 10:55:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13652625 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (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 4FD8E150982; Fri, 3 May 2024 10:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733735; cv=none; b=OzRvDQcVBC8GHFKYPAWXLz2ANBndap2IkqL9jlY+2ZdM/wB4PBQ1N1TU3IVlkKQ36jZW0QScP5tale1j2OBJBCmmyQfai9Irf/CxCaQ/WBChAwvLdbTx+veqtKEUgLS+evSsuBc2yrEMrlLnBVyx/bs+jpG+IcKgeSsxmKRMTUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733735; c=relaxed/simple; bh=/4zLaVQuU1wmeIeAfJH/eguO+ohhbE6XUdh7n4342pU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p1p3O5+amp27FGgB6C0mVZmhUYyEePH0ZrOUlr5PGo3be9Q7EUlq5PPpGVYh9tCbXemSKwos1qJCrqgRX85f3XvbyZWHKGuNcH0Y5oR/26cW6WsqSsNjYJEuQ588xS4GkBYHQzI9dE8MJ3GcCriPC+v/HcFLE4/NkrzI8o+n7o4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=scVx3x5/; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="scVx3x5/" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 92ECB600A7; Fri, 3 May 2024 10:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1714733723; bh=/4zLaVQuU1wmeIeAfJH/eguO+ohhbE6XUdh7n4342pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scVx3x5/gLpgoyoIzDOg7FpjAu5K34yUsCx4Z+B0tdNicRPPHpOgA6TvHgURzaBX3 Z0t+p1PEZOstkeixFT/4RbqqAQM/U79iVgM5XGpQb9HEVgYOQvma/4l1/YwyY7Zq+o 0bEmCBjukHS4/vygo74rwaMSrHl0A2EgMJyldCjyBSyotC7T9yWVTB6siVr43EGO7j Q60C5qPhqNiLmAoi8FblbcrCS+UAC7dQHA0+8R7CFvbNVM6YN4WUwLW1KtOVTt+rjv Hok6JUCNjJsQ/qKCvInHR1Q7WA0yklClVcAfTAIUgcud0rtdeLGbxK1fYNMI99V1Ye 1s0BZyqp8GVtQ== Received: by x201s (Postfix, from userid 1000) id 333EA21BB74; Fri, 03 May 2024 10:55:12 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Manish Chopra Subject: [PATCH net-next 3/3] net: qede: use return from qede_flow_parse_ports() Date: Fri, 3 May 2024 10:55:03 +0000 Message-ID: <20240503105505.839342-4-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240503105505.839342-1-ast@fiberby.net> References: <20240503105505.839342-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org When calling qede_flow_parse_ports(), then the return code was only used for a non-zero check, and then -EINVAL was returned. qede_flow_parse_ports() can currently fail with: * -EINVAL This patch changes qede_flow_parse_v{4,6}_common() to use the actual return code from qede_flow_parse_ports(), so it's no longer assumed that all errors are -EINVAL. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Simon Horman --- drivers/net/ethernet/qlogic/qede/qede_filter.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index 07af0464eb1e..ded48523c383 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -1725,6 +1725,7 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule, struct qede_arfs_tuple *t) { struct in6_addr zero_addr, addr; + int err; memset(&zero_addr, 0, sizeof(addr)); memset(&addr, 0xff, sizeof(addr)); @@ -1746,8 +1747,9 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule, memcpy(&t->dst_ipv6, &match.key->dst, sizeof(addr)); } - if (qede_flow_parse_ports(edev, rule, t)) - return -EINVAL; + err = qede_flow_parse_ports(edev, rule, t); + if (err) + return err; return qede_set_v6_tuple_to_profile(edev, t, &zero_addr); } @@ -1756,6 +1758,8 @@ static int qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule, struct qede_arfs_tuple *t) { + int err; + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) { struct flow_match_ipv4_addrs match; @@ -1770,8 +1774,9 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule, t->dst_ipv4 = match.key->dst; } - if (qede_flow_parse_ports(edev, rule, t)) - return -EINVAL; + err = qede_flow_parse_ports(edev, rule, t); + if (err) + return err; return qede_set_v4_tuple_to_profile(edev, t); }