Conversation
c0bf649 to
9b1b030
Compare
|
Can you add some description what you are doing and why |
|
A proposal is required. |
14bbc8e to
0a2d78f
Compare
Codecov ReportAttention: Patch coverage is
Continue to review full report in Codecov by Sentry.
|
proposal: #1202 |
| if (strcmp(key, "All") == 0) { | ||
| msg = (struct bpf_mem_ptr *)(ctx->t_ctx); | ||
| if (strnstr(msg->ptr, subptr, subptr_len) != NULL) { | ||
| return 1; |
There was a problem hiding this comment.
Is it possible to use variables to indicate what 1 and 0 mean?
bpf/kmesh/ads/include/route_config.h
Outdated
| DEBUG, | ||
| ROUTER_CONFIG, | ||
| "match virtual_host, name=\"%s\"\n", | ||
| (char *)KMESH_GET_PTR_VAL(virt_host->name, char *)); |
There was a problem hiding this comment.
The number of instructions occupied by BPF_LOG is very large, and printing logs within multiple nested loops can cause the total instruction count of the ebpf program to exceed 1,000,000 insn.
so I move it out of func
bpf/include/bpf_helper_defs_ext.h
Outdated
| static __u64 (*bpf__strncmp)(const char *s1, __u32 s1_size, const char *s2) = (void *)174; | ||
| static long (*bpf_parse_header_msg)(struct bpf_mem_ptr *msg) = (void *)175; | ||
| static void *(*bpf_get_msg_header_element)(void *name) = (void *)176; | ||
| static int (*bpf_km_strnstr)( |
There was a problem hiding this comment.
The comment needs to be supplemented and the usage needs to be defined.
The naming needs to be adjusted.
|
|
||
| data = kmesh_protocol_data_search(key); | ||
| if (!data) | ||
| return 0; |
There was a problem hiding this comment.
The return value need modified.
| if (!cur->parse_protocol_msg) | ||
| continue; | ||
| ret = cur->parse_protocol_msg(msg); | ||
| ret = cur->parse_protocol_msg(ctx); |
There was a problem hiding this comment.
The CTX does not need to be transferred.
bpf/kmesh/ads/cgroup_sock.c
Outdated
|
|
||
| static const char kmesh_module_name[] = "kmesh_defer"; | ||
|
|
||
| static char kmesh_module_name_get[16]; |
There was a problem hiding this comment.
Write a macro to define
kernel/ko_src/kmesh/defer_connect.c
Outdated
| err = sk->sk_prot->connect(sk, (struct sockaddr *)&addr_in, sizeof(struct sockaddr_in)); | ||
| inet_sk(sk)->bpf_defer_connect = 0; | ||
| err = sk->sk_prot->connect(sk, (struct sockaddr *)&uaddr, sizeof(struct sockaddr_in)); | ||
| inet_sk(sk)->defer_connect = 0; |
There was a problem hiding this comment.
Retry needs to be allowed. The value is changed to line 113.
| return -ENOMEM; | ||
| kmesh_defer_proto_ops = kmalloc(sizeof(struct proto_ops), GFP_ATOMIC); | ||
| if (!kmesh_defer_proto_ops) | ||
| return -ENOMEM; |
291dd6f to
de3101a
Compare
Signed-off-by: lec-bit <glfhmzmy@126.com>
Signed-off-by: lec-bit <glfhmzmy@126.com>
bpf/kmesh/ads/cgroup_sock.c
Outdated
| #else // KMESH_ENABLE_HTTP | ||
| ret = listener_manager(ctx, listener, NULL); | ||
| ret = bpf_getsockopt(ctx, IPPROTO_TCP, TCP_ULP, (void *)kmesh_module_name_get, KMESH_MODULE_NAME_LEN); | ||
| if (ret != 0 || bpf__strncmp(kmesh_module_name_get, KMESH_MODULE_NAME_LEN, kmesh_module_name)) { |
There was a problem hiding this comment.
When the bpf_getsockopt command is executed successfully, 0 should be returned. When the command is executed for the first time, the corresponding ulp model is not found. What should be the ret value?
bpf/kmesh/ads/cgroup_sock.c
Outdated
| return 0; | ||
| } | ||
| #endif | ||
| ret = listener_manager(ctx, listener, ctx); |
There was a problem hiding this comment.
What is the purpose of changing the third parameter from NULL to ctx?
There was a problem hiding this comment.
Forgot to modify it back after debugging, fixed
bpf/kmesh/ads/include/route_config.h
Outdated
| return 0; | ||
|
|
||
| if (bpf_strnstr(ptr, prefix, BPF_DATA_MAX_LEN) == NULL) | ||
| if (bpf_km_header_strnstr(ctx, uri, uri_len, prefix, BPF_DATA_MAX_LEN) == 0) { |
There was a problem hiding this comment.
The code style is unified. Generally, if (!bpf_km_header_strnstr(ctx, uri, uri_len, prefix, BPF_DATA_MAX_LEN)) is written in kernel.
Signed-off-by: lec-bit <glfhmzmy@126.com>
Signed-off-by: lec-bit <glfhmzmy@126.com>
pkg/kolog/kolog.go
Outdated
| return time.Time{}, err | ||
| } | ||
|
|
||
| for _, line := range strings.Split(string(data), "\n") { |
There was a problem hiding this comment.
change to use bufio.NewScanner, read line by line
pkg/kolog/kolog.go
Outdated
| case <-stopCh: | ||
| return | ||
| default: | ||
| line, err := reader.ReadString('\n') |
There was a problem hiding this comment.
nit: can use scanner as well
Signed-off-by: lec-bit <glfhzmy@126.com>
d3eb7da to
8ec8456
Compare
Signed-off-by: lec-bit <glfhzmy@126.com>
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bitcoffeeiux, hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: