go-tc icon indicating copy to clipboard operation
go-tc copied to clipboard

feat: class support dsmark.

Open xujunjie-cover opened this issue 1 year ago • 2 comments

xujunjie-cover avatar Jun 27 '24 05:06 xujunjie-cover

Hi @xujunjie-cover :wave:

Thanks for your contribution! Can you provide some insights, why dsmark should be added here? I can't identify its counterpart in the Linux kernel - can you point me to it?

florianl avatar Jun 27 '24 18:06 florianl

Hi @xujunjie-cover 👋

Thanks for your contribution! Can you provide some insights, why dsmark should be added here? I can't identify its counterpart in the Linux kernel - can you point me to it?

Sorry, I didn't understand everything before. I want set dscp for egress package from netns. cli:

tc qdisc add dev eth0 parent root handle 10: dsmark indices 8 set_tc_index
tc class change dev eth0 parent 10: classid 10:1 dsmark mask 0x03 value 0x20

code:

	dsmarkQdisc := tc.Object{
		Msg: tc.Msg{
			Family:  unix.AF_UNSPEC,
			Ifindex: index,
			Handle:  xxx,
			Parent:  root,
			Info:    0,
		},
		Attribute: tc.Attribute{
			Kind: "dsmark",
			Dsmark: &tc.Dsmark{
				Indices:    &indices,
				SetTCIndex: &setTCIndex,
			},
		},
	}
add qdisc

	dsmarkClass := tc.Object{
		Msg: tc.Msg{
			Family:  unix.AF_UNSPEC,
			Ifindex: index,
			Handle:  xxx + 1,
			Parent:  xxx,
			Info:    0,
		},
		Attribute: tc.Attribute{
			Kind: "dsmark",
			Dsmark: &tc.Dsmark{
				Mask:  &mask,
				Value: &value,
			},
		},
	}

replace dsmarkClass

it works on kernel 5.10.

But dsmark was removed。

before linux 6.2 https://github.com/torvalds/linux/blob/c9c3395d5e3dcc6daee66c6908354d47bf98cb0c/net/sched/sch_dsmark.c#L116

linux 6.3 Retire dsmark qdisc. I think i should close this pr. https://github.com/torvalds/linux/commit/11b8b2e70a9b4a1b60eefc0cd79cd2d3c08545f1

xujunjie-cover avatar Jun 30 '24 10:06 xujunjie-cover

sorry that I got lost track on this PR and just merge it now. Thanks for your contribution! :pray:

florianl avatar Jul 26 '24 06:07 florianl