On Wed, Feb 5, 2025 at 5:30 PM Hou Tao <houtao@xxxxxxxxxxxxxxx> wrote: > > Hi, > > On 2/5/2025 11:27 AM, Jason Xing wrote: > > On Wed, Feb 5, 2025 at 10:57 AM Hou Tao <houtao@xxxxxxxxxxxxxxx> wrote: > >> Hi, > >> > >> On 2/4/2025 10:39 AM, Jason Xing wrote: > >>> Error messages: > >>> selftests/bpf/prog_tests/sockopt_sk.c: In function ‘getsetsockopt’: > >>> selftests/bpf/prog_tests/sockopt_sk.c:22:31: error: field ‘zc’ has incomplete type > >>> struct tcp_zerocopy_receive zc; > >>> ^~ > >>> selftests/bpf/prog_tests/sockopt_sk.c:169:32: error: ‘TCP_ZEROCOPY_RECEIVE’ undeclared (first use in this function) > >>> err = getsockopt(fd, SOL_TCP, TCP_ZEROCOPY_RECEIVE, &buf, &optlen); > >>> ^~~~~~~~~~~~~~~~~~~~ > >>> > >>> Fix it by introducing the right header. > >>> > >>> Signed-off-by: Jason Xing <kerneljasonxing@xxxxxxxxx> > >>> --- > >>> tools/testing/selftests/bpf/prog_tests/sockopt_sk.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c > >>> index ba6b3ec1156a..e0a9785ffcdc 100644 > >>> --- a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c > >>> +++ b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c > >>> @@ -2,7 +2,7 @@ > >>> #include <test_progs.h> > >>> #include "cgroup_helpers.h" > >>> > >>> -#include <netinet/tcp.h> > >>> +#include <uapi/linux/tcp.h> > >> Should it be <linux/tcp.h> instead ? > > I thought that too, but I altered my thoughts after reading this > > commit[1], totally without knowing why the tcp part should be changed. > > Should I change it back? > > Thanks for pointing the commit to me. Under my local environment, it > seems both netinet/tcp.h and linux/tcp define tcp_zerocopy_receive and > tcphdr, and I think that is the reason why the commit changes tcp as > well. For the following build error: > > selftests/bpf/prog_tests/sockopt_sk.c:22:31: error: field ‘zc’ has > incomplete type > struct tcp_zerocopy_receive zc; > > I think maybe your local environment is a bit out-of-date. I prefer to > keep it as-is. Thanks for your review. Right, but I believe many users can't manage to upgrade to the latest version for the whole system. The selftests are supposed to be compatible, I reckon. It's surely not bad to consider the compatibility after adjusting the header file. Thanks, Jason