DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	Ray Kinsella <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>
Cc: dev@dpdk.org, Dan Gora <dg@adax.com>
Subject: [dpdk-dev] [PATCH] kni: update link only on change
Date: Thu, 24 Jun 2021 14:32:16 +0100	[thread overview]
Message-ID: <20210624133216.3088933-1-ferruh.yigit@intel.com> (raw)

'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


             reply	other threads:[~2021-06-24 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 13:32 Ferruh Yigit [this message]
2021-07-09 15:19 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210624133216.3088933-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=dg@adax.com \
    --cc=mdr@ashroe.eu \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).