]> git.proxmox.com Git - ovs.git/commitdiff
netdev-afxdp: Error when no XDP program loaded.
authorWilliam Tu <u9012063@gmail.com>
Wed, 24 Jul 2019 15:21:35 +0000 (08:21 -0700)
committerIlya Maximets <i.maximets@samsung.com>
Mon, 29 Jul 2019 11:49:45 +0000 (14:49 +0300)
netdev-afxdp requires XDP program to be loaded.  When prog_id == 0,
it indicates no XDP program, so return error and free resources.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
lib/netdev-afxdp.c

index ff426750d709e98498807c9ae3444855172a4a69..b7cc0d9886c73178abb4acb5e933eefb23ac5e9c 100644 (file)
@@ -277,8 +277,12 @@ xsk_configure_socket(struct xsk_umem_info *umem, uint32_t ifindex,
 
     /* Make sure the built-in AF_XDP program is loaded. */
     ret = bpf_get_link_xdp_id(ifindex, &prog_id, cfg.xdp_flags);
-    if (ret) {
-        VLOG_ERR("Get XDP prog ID failed (%s)", ovs_strerror(errno));
+    if (ret || !prog_id) {
+        if (ret) {
+            VLOG_ERR("Get XDP prog ID failed (%s)", ovs_strerror(errno));
+        } else {
+            VLOG_ERR("No XDP program is loaded at ifindex %d", ifindex);
+        }
         xsk_socket__delete(xsk->xsk);
         free(xsk);
         return NULL;