lldpad/lldpad-0.9.41-add-a-vdp_vsi-to-count-nr-of-VSIs.patch
2011-04-21 09:10:21 +02:00

57 lines
1.4 KiB
Diff

From 91c351053a59846d7baac09af5a4c9fa3cc83f36 Mon Sep 17 00:00:00 2001
From: Jens Osterkamp <jens@linux.vnet.ibm.com>
Date: Wed, 6 Apr 2011 08:33:53 -0700
Subject: [PATCH 28/51] add a vdp_vsi to count nr of VSIs
This adds a function to the VDP code which allows to query the number of
currently available VSIs for an interface.
This is used in the rework of the EVB TLV code to include the number of
configured VSIs in the TLV.
Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Petr Sabata <psabata@redhat.com>
---
lldp_vdp.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/lldp_vdp.c b/lldp_vdp.c
index 9b1d222..d1adb66 100644
--- a/lldp_vdp.c
+++ b/lldp_vdp.c
@@ -149,6 +149,31 @@ void vdp_ack_profiles(struct vdp_data *vd, int seqnr)
}
+/* vdp_vsis - find out number of VSIs for this interface
+ * @ifname: interfac name
+ *
+ * returns the number of VSIs
+ *
+ * walk through the list of VSIs and return the count.
+ */
+int vdp_vsis(char *ifname)
+{
+ struct vdp_data *vd;
+ struct vsi_profile *p;
+ int count = 0;
+
+ vd = vdp_data(ifname);
+
+ if (!vd)
+ return 0;
+
+ LIST_FOREACH(p, &vd->profile_head, profile) {
+ count++;
+ }
+
+ return count;
+}
+
/* vdp_vsis_pending - check for pending VSIs
* @vd: vdp data for the interface
*
--
1.7.4.4