libbpf expected backward compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Reading the tools/lib/bpf/README.rst file, I could find what should be
the expected backward compatibility of the library with older kernels.

Should I be able to use a libbpf compiled from a kernel newer than the
one I will be running or vice-versa?

I've noticed that the following diff (part of
421ecf02c8e73e1d95e16e5e12aa19146561edba) makes the xsk_socket__create
function return errno 95 'Operation not supported' on older kernels
(5.1.0 in this particular case).


diff --git a/src/xsk.c b/src/xsk.c
index 7ef6293..bf15a80 100644
@@ -597,6 +599,16 @@ int xsk_socket__create(struct xsk_socket
**xsk_ptr, const char *ifname,
        }

        xsk->prog_fd = -1;
+
+       optlen = sizeof(opts);
+       err = getsockopt(xsk->fd, SOL_XDP, XDP_OPTIONS, &opts, &optlen);
+       if (err) {
+               err = -errno;
+               goto out_mmap_tx;
+       }
+
+       xsk->zc = opts.flags & XDP_OPTIONS_ZEROCOPY;

Should this really return Operation not supported or should it handle
this particular error and set the zc flag as false?

-- 
Rafael Vargas



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux