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

export send_byte and send_recv_data #6715

Closed

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: export send_byte and send_recv_data
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 623bdd5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a70f5d8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: ca4ddc2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 9dc182c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 2a24e24
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c186ed1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: ce09cbd
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 15ea39a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c07b4bc
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

Geliang Tang added 3 commits April 2, 2024 19:53
The helper send_byte is defined in mptcp.c, sk_lookup.c and tcp_rtt.c.
It makes sense to export it into network_helpers.h to let it can be
used for all BPF selftests.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Avoid setting total_bytes and stop as global variables, this patch adds
a new struct named send_recv_arg to pass arguments between threads. Put
these two variables together with fd into this struct and pass it to
server thread, so that server thread can access these two variables without
setting them as global ones.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
This patch extracts the code to send and receive data into a new
helper named send_recv_data() in network_helpers.c and export it
in network_helpers.h.

This helper will be used for MPTCP BPF selftests.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 49b73fa
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c53908b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/netdevbpf/list/?series=840470
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Applying: selftests/bpf: Export send_byte helper
Using index info to reconstruct a base tree...
M	tools/testing/selftests/bpf/network_helpers.c
M	tools/testing/selftests/bpf/network_helpers.h
M	tools/testing/selftests/bpf/prog_tests/mptcp.c
Falling back to patching base and 3-way merge...
Auto-merging tools/testing/selftests/bpf/prog_tests/mptcp.c
Auto-merging tools/testing/selftests/bpf/network_helpers.h
Auto-merging tools/testing/selftests/bpf/network_helpers.c
CONFLICT (content): Merge conflict in tools/testing/selftests/bpf/network_helpers.c
Patch failed at 0001 selftests/bpf: Export send_byte helper
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch'

conflict:

diff --cc tools/testing/selftests/bpf/network_helpers.c
index 04175e16195a,f2f8f7388d7c..000000000000
--- a/tools/testing/selftests/bpf/network_helpers.c
+++ b/tools/testing/selftests/bpf/network_helpers.c
@@@ -498,50 -498,11 +498,59 @@@ int get_socket_local_port(int sock_fd
  	return -1;
  }
  
++<<<<<<< HEAD
 +int get_hw_ring_size(char *ifname, struct ethtool_ringparam *ring_param)
 +{
 +	struct ifreq ifr = {0};
 +	int sockfd, err;
 +
 +	sockfd = socket(AF_INET, SOCK_DGRAM, 0);
 +	if (sockfd < 0)
 +		return -errno;
 +
 +	memcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 +
 +	ring_param->cmd = ETHTOOL_GRINGPARAM;
 +	ifr.ifr_data = (char *)ring_param;
 +
 +	if (ioctl(sockfd, SIOCETHTOOL, &ifr) < 0) {
 +		err = errno;
 +		close(sockfd);
 +		return -err;
 +	}
 +
 +	close(sockfd);
 +	return 0;
 +}
 +
 +int set_hw_ring_size(char *ifname, struct ethtool_ringparam *ring_param)
 +{
 +	struct ifreq ifr = {0};
 +	int sockfd, err;
 +
 +	sockfd = socket(AF_INET, SOCK_DGRAM, 0);
 +	if (sockfd < 0)
 +		return -errno;
 +
 +	memcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 +
 +	ring_param->cmd = ETHTOOL_SRINGPARAM;
 +	ifr.ifr_data = (char *)ring_param;
 +
 +	if (ioctl(sockfd, SIOCETHTOOL, &ifr) < 0) {
 +		err = errno;
 +		close(sockfd);
 +		return -err;
 +	}
 +
 +	close(sockfd);
++=======
+ int send_byte(int fd)
+ {
+ 	char b = 0x55;
+ 
+ 	if (!ASSERT_EQ(write(fd, &b, sizeof(b)), 1, "send single byte"))
+ 		return -1;
++>>>>>>> selftests/bpf: Export send_byte helper
  	return 0;
  }

@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=840470 expired. Closing PR.

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.

0 participants