Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 201c44bd authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

net: cls_u32: be more strict about skip-sw flag for knodes



Return an error if user requested skip-sw and the underlaying
hardware cannot handle tc offloads (or offloads are disabled).
This patch fixes the knode handling.

Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6eef3801
Loading
Loading
Loading
Loading
+19 −18
Original line number Diff line number Diff line
@@ -508,7 +508,9 @@ static int u32_replace_hw_knode(struct tcf_proto *tp,
	offload.type = TC_SETUP_CLSU32;
	offload.cls_u32 = &u32_offload;

	if (tc_should_offload(dev, tp, flags)) {
	if (!tc_should_offload(dev, tp, flags))
		return tc_skip_sw(flags) ? -EINVAL : 0;

	offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
	offload.cls_u32->knode.handle = n->handle;
	offload.cls_u32->knode.fshift = n->fshift;
@@ -528,7 +530,6 @@ static int u32_replace_hw_knode(struct tcf_proto *tp,
					    tp->protocol, &offload);
	if (tc_skip_sw(flags))
		return err;
	}

	return 0;
}