]> git.droids-corp.org - dpdk.git/commitdiff
kni: update link only on change
authorFerruh Yigit <ferruh.yigit@intel.com>
Thu, 24 Jun 2021 13:32:16 +0000 (14:32 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 9 Jul 2021 15:22:42 +0000 (17:22 +0200)
'rte_kni_update_link()' updates virtual KNI interface link using kernel
sysfs interface.
If the requested link status is same as interface link status, do not
update the link status but return with success.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/kni/rte_kni.c
lib/kni/version.map

index eb24b0d0ae4e5e7750cef698c97b6df26dbf9c45..d3e236005ed59b6234bd723143dab37e2ab440d6 100644 (file)
@@ -811,6 +811,9 @@ rte_kni_update_link(struct rte_kni *kni, unsigned int linkup)
        }
        old_linkup = (old_carrier[0] == '1');
 
+       if (old_linkup == (int)linkup)
+               goto out;
+
        new_carrier = linkup ? "1" : "0";
        ret = write(fd, new_carrier, 1);
        if (ret < 1) {
@@ -818,7 +821,7 @@ rte_kni_update_link(struct rte_kni *kni, unsigned int linkup)
                close(fd);
                return -1;
        }
-
+out:
        close(fd);
        return old_linkup;
 }
index a93da95f3671d3d865dde7dbff0352fef4107f1b..bb810a7f2f38ed6e5c9e709008f8e46e0e5fe865 100644 (file)
@@ -19,5 +19,6 @@ DPDK_21 {
 EXPERIMENTAL {
        global:
 
+       # updated in v21.08
        rte_kni_update_link;
 };