diff mbox series

[net-next,1/1] net/sched: We should only add appropriate qdiscs blocks to ports' xarray

Message ID 20231228140909.96711-1-victor@mojatatu.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/1] net/sched: We should only add appropriate qdiscs blocks to ports' xarray | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1141 this patch: 1141
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 43 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Victor Nogueira Dec. 28, 2023, 2:09 p.m. UTC
We should only add qdiscs to the blocks ports' xarray in ingress that
support ingress_block_set/get or in egress that support
egress_block_set/get.

Fixes: 913b47d3424e ("net/sched: Introduce tc block netdev tracking infra")

Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 net/sched/sch_api.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

Comments

Ido Schimmel Dec. 28, 2023, 2:58 p.m. UTC | #1
On Thu, Dec 28, 2023 at 11:09:09AM -0300, Victor Nogueira wrote:
> We should only add qdiscs to the blocks ports' xarray in ingress that
> support ingress_block_set/get or in egress that support
> egress_block_set/get.
> 
> Fixes: 913b47d3424e ("net/sched: Introduce tc block netdev tracking infra")
> 

Unnecessary blank line

> Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>

Reported-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>

Thanks!
diff mbox series

Patch

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 299086bb6205..426be81276f1 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1187,23 +1187,29 @@  static int qdisc_block_add_dev(struct Qdisc *sch, struct net_device *dev,
 	struct tcf_block *block;
 	int err;
 
-	block = cl_ops->tcf_block(sch, TC_H_MIN_INGRESS, NULL);
-	if (block) {
-		err = xa_insert(&block->ports, dev->ifindex, dev, GFP_KERNEL);
-		if (err) {
-			NL_SET_ERR_MSG(extack,
-				       "ingress block dev insert failed");
-			return err;
+	if (sch->ops->ingress_block_get) {
+		block = cl_ops->tcf_block(sch, TC_H_MIN_INGRESS, NULL);
+		if (block) {
+			err = xa_insert(&block->ports, dev->ifindex, dev,
+					GFP_KERNEL);
+			if (err) {
+				NL_SET_ERR_MSG(extack,
+					       "ingress block dev insert failed");
+				return err;
+			}
 		}
 	}
 
-	block = cl_ops->tcf_block(sch, TC_H_MIN_EGRESS, NULL);
-	if (block) {
-		err = xa_insert(&block->ports, dev->ifindex, dev, GFP_KERNEL);
-		if (err) {
-			NL_SET_ERR_MSG(extack,
-				       "Egress block dev insert failed");
-			goto err_out;
+	if (sch->ops->egress_block_get) {
+		block = cl_ops->tcf_block(sch, TC_H_MIN_EGRESS, NULL);
+		if (block) {
+			err = xa_insert(&block->ports, dev->ifindex, dev,
+					GFP_KERNEL);
+			if (err) {
+				NL_SET_ERR_MSG(extack,
+					       "Egress block dev insert failed");
+				goto err_out;
+			}
 		}
 	}