DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: update link only on change
@ 2021-06-24 13:32 Ferruh Yigit
  2021-07-09 15:19 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Ferruh Yigit @ 2021-06-24 13:32 UTC (permalink / raw)
  To: Ferruh Yigit, Ray Kinsella, Neil Horman; +Cc: dev, Dan Gora

'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>
---
Cc: Dan Gora <dg@adax.com>
---
 lib/kni/rte_kni.c   | 5 ++++-
 lib/kni/version.map | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
index 9dae6a8d7c0c..8ac4484272b0 100644
--- a/lib/kni/rte_kni.c
+++ b/lib/kni/rte_kni.c
@@ -810,6 +810,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) {
@@ -817,7 +820,7 @@ rte_kni_update_link(struct rte_kni *kni, unsigned int linkup)
 		close(fd);
 		return -1;
 	}
-
+out:
 	close(fd);
 	return old_linkup;
 }
diff --git a/lib/kni/version.map b/lib/kni/version.map
index a93da95f3671..bb810a7f2f38 100644
--- a/lib/kni/version.map
+++ b/lib/kni/version.map
@@ -19,5 +19,6 @@ DPDK_21 {
 EXPERIMENTAL {
 	global:
 
+	# updated in v21.08
 	rte_kni_update_link;
 };
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: update link only on change
  2021-06-24 13:32 [dpdk-dev] [PATCH] kni: update link only on change Ferruh Yigit
@ 2021-07-09 15:19 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2021-07-09 15:19 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Ray Kinsella, dev, Dan Gora

24/06/2021 15:32, Ferruh Yigit:
> '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>

Applied, thanks.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-09 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 13:32 [dpdk-dev] [PATCH] kni: update link only on change Ferruh Yigit
2021-07-09 15:19 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).