Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use go-tc instead of shell #219

Merged
merged 7 commits into from
Sep 23, 2022

Conversation

kebe7jun
Copy link
Member

@kebe7jun kebe7jun commented Sep 23, 2022

istio-proxy@sleep-784d69f945-bjb4m:/$ tc filter show dev eth0 ingress
filter protocol all pref 66 bpf chain 0
filter protocol all pref 66 bpf chain 0 handle 0x1 mb_tc_ingress direct-action not_in_hw id 1236 tag 8228568dfe62b337
istio-proxy@sleep-784d69f945-bjb4m:/$ tc filter show dev eth0 egress
filter protocol all pref 66 bpf chain 0
filter protocol all pref 66 bpf chain 0 handle 0x1 mb_tc_egress direct-action not_in_hw id 1275 tag bceb4eff4a7e13e6
# bpftool prog
1242: cgroup_sock_addr  name mb_sock_connect  tag 899fc03b5f58d07f  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 9512B  jited 6197B  memlock 12288B  map_ids 1553,1550,1551,1552,1558
	btf_id 59496
1247: sock_ops  name mb_sockops  tag b2c6c93d04f557a3  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 1600B  jited 879B  memlock 4096B  map_ids 1550,1552,1560,1559
	btf_id 59500
1252: cgroup_sockopt  name mb_get_sockopt  tag ffbd8894d2844c48  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 968B  jited 554B  memlock 4096B  map_ids 1559
	btf_id 59504
1257: sk_msg  name mb_msg_redir  tag 799589f0f98c291f  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 504B  jited 297B  memlock 4096B  map_ids 1560
	btf_id 59508
1262: cgroup_sock_addr  name mb_bind  tag 57cd311f2e27366b  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 16B  jited 18B  memlock 4096B
	btf_id 59512
1267: cgroup_sock_addr  name mb_sendmsg4  tag 722e3d7b05977148  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 800B  jited 466B  memlock 4096B  map_ids 1550
	btf_id 59516
1272: cgroup_sock_addr  name mb_recvmsg4  tag 736ee1370a31bbd0  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 864B  jited 500B  memlock 4096B  map_ids 1550
	btf_id 59520
1274: sched_cls  name mb_tc_ingress  tag 8228568dfe62b337  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 3016B  jited 1954B  memlock 4096B  map_ids 1559,1551
	btf_id 59523
1275: sched_cls  name mb_tc_egress  tag bceb4eff4a7e13e6  gpl
	loaded_at 2022-09-23T10:23:37+0800  uid 0
	xlated 1504B  jited 885B  memlock 4096B  map_ids 1559
	btf_id 59523

@mergify
Copy link

mergify bot commented Sep 23, 2022

Welcome to the Merbridge OpenSource Community!👏

We're delighted to have you onboard 💘

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2022

Codecov Report

Merging #219 (620d030) into main (8ee2c20) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main     #219   +/-   ##
=======================================
  Coverage   40.33%   40.33%           
=======================================
  Files           7        7           
  Lines         419      419           
=======================================
  Hits          169      169           
  Misses        236      236           
  Partials       14       14           
Flag Coverage Δ
unittests 40.33% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
controller/pod.go 31.05% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kebe7jun
Copy link
Member Author

@dddddai PTAL.

Copy link
Member

@dddddai dddddai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

internal/cni-server/cni-plugin.go Outdated Show resolved Hide resolved
internal/cni-server/cni-plugin.go Show resolved Hide resolved
internal/cni-server/cni-plugin.go Show resolved Hide resolved
Egress *ebpf.Program `ebpf:"mb_tc_egress"`
}
ps := progs{}
err = coll.LoadAndAssign(&ps, &ebpf.CollectionOptions{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question: how can we tell which section to load?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not use sec to distinguish, it uses function names as separate procedures, see the description. mb_tc_ingress or mb_tc_egress.

}
egress := ebpfs.GetTCEgressProg()
if ing == nil {
return fmt.Errorf("can not get ingress prog")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ingress -> egress

@mergify mergify bot merged commit fc0f58b into merbridge:main Sep 23, 2022
@kebe7jun kebe7jun deleted the feature/use-go-tc-instead-sh branch September 23, 2022 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants