[PATCH 1/2] ISCSID: Added vlan field to the iface struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Defined the iface.vlan field to hold the VLAN tag of the interface
in the corresponding iface file.  This will then be passed to the
iSCSI HBA prior to the connect request.

Signed-off-by: Eddie Wai <eddie.wai@xxxxxxxxxxxx>
---
 usr/config.h         |    4 ++++
 usr/iface.c          |   19 +++++++++++++++++--
 usr/iscsi_settings.h |    1 +
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/usr/config.h b/usr/config.h
index 3f61118..b967359 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -205,6 +205,10 @@ typedef struct iface_rec {
 	 */
 	char			alias[TARGET_NAME_MAXLEN + 1];
 	char			iname[TARGET_NAME_MAXLEN + 1];
+ 	/*
+	 * This is used only for hba 
+	 */
+	char			vlan[ISCSI_MAX_IFACE_LEN];
 	/*
 	 * Following fields are used to support UIO driver based
 	 * DHCP/ARP functionality for offload capable cards.
diff --git a/usr/iface.c b/usr/iface.c
index 52371c7..5543e89 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -501,6 +501,8 @@ void iface_copy(struct iface_rec *dst, struct iface_rec *src)
 		strcpy(dst->transport_name, src->transport_name);
 	if (strlen(src->iname))
 		strcpy(dst->iname, src->iname);
+	if (strlen(src->vlan))
+		strcpy(dst->vlan, src->vlan);
 	if (strlen(src->uiolib))
 		strcpy(dst->uiolib, src->uiolib);
 }
@@ -577,6 +579,14 @@ int iface_is_bound_by_ipaddr(struct iface_rec *iface)
 	return 0;
 }
 
+int iface_is_bound_by_vlan(struct iface_rec *iface)
+{
+	if (iface && strlen(iface->vlan) &&
+	   strcmp(iface->vlan, DEFAULT_VLAN))
+		return 1;
+	return 0;
+}
+
 int iface_is_bound_by_uiolib(struct iface_rec *iface)
 {
 	if (iface && strlen(iface->uiolib))
@@ -619,6 +629,10 @@ void iface_print(struct iface_rec *iface, char *prefix)
 		printf("%sIface Netdev: %s\n", prefix, iface->netdev);
 	else
 		printf("%sIface Netdev: %s\n", prefix, UNKNOWN_VALUE);
+	if (strlen(iface->vlan))
+		printf("%sIface VLAN ID: %s\n", prefix, iface->vlan);
+	else
+		printf("%sIface VLAN ID: %s\n", prefix, UNKNOWN_VALUE);
 }
 
 struct iface_print_node_data {
@@ -664,14 +678,15 @@ int iface_print_tree(void *data, struct iface_rec *iface)
 
 int iface_print_flat(void *data, struct iface_rec *iface)
 {
-	printf("%s %s,%s,%s,%s,%s\n",
+	printf("%s %s,%s,%s,%s,%s,%s\n",
 		strlen(iface->name) ? iface->name : UNKNOWN_VALUE,
 		strlen(iface->transport_name) ? iface->transport_name :
 							UNKNOWN_VALUE,
 		strlen(iface->hwaddress) ? iface->hwaddress : UNKNOWN_VALUE,
 		strlen(iface->ipaddress) ? iface->ipaddress : UNKNOWN_VALUE,
 		strlen(iface->netdev) ? iface->netdev : UNKNOWN_VALUE,
-		strlen(iface->iname) ? iface->iname : UNKNOWN_VALUE);
+		strlen(iface->iname) ? iface->iname : UNKNOWN_VALUE,
+		strlen(iface->vlan) ? iface->vlan : UNKNOWN_VALUE);
 	return 0;
 }
 
diff --git a/usr/iscsi_settings.h b/usr/iscsi_settings.h
index 32d0e85..e5f8aa0 100644
--- a/usr/iscsi_settings.h
+++ b/usr/iscsi_settings.h
@@ -27,6 +27,7 @@
 #define DEFAULT_IPADDRESS	"default"
 #define DEFAULT_HWADDRESS	"default"
 #define DEFAULT_TRANSPORT	"tcp"
+#define DEFAULT_VLAN		"0"
 
 #define PORTAL_GROUP_TAG_UNKNOWN -1
 
-- 
1.7.0.5


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux