[SCSI] iscsi class: expand vlan support
authorMike Christie <michaelc@cs.wisc.edu>
Mon, 25 Jul 2011 18:48:47 +0000 (13:48 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Sat, 27 Aug 2011 14:36:18 +0000 (08:36 -0600)
Add support to set vlan priority and enable/disble a vlan.

Patch based on code from Vikas Chaudhary.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_transport_iscsi.c
include/scsi/iscsi_if.h

index 2e9b68215593b397de1342e930854cd895bbb54a..13f90515ff6eabfb8916a9267ba514259730e5a4 100644 (file)
@@ -319,6 +319,8 @@ iscsi_iface_net_attr(ipv6_iface, linklocal_autocfg,
 /* common read only iface attribute */
 iscsi_iface_net_attr(iface, enabled, ISCSI_NET_PARAM_IFACE_ENABLE);
 iscsi_iface_net_attr(iface, vlan, ISCSI_NET_PARAM_VLAN_ID);
+iscsi_iface_net_attr(iface, vlan_priority, ISCSI_NET_PARAM_VLAN_PRIORITY);
+iscsi_iface_net_attr(iface, vlan_enabled, ISCSI_NET_PARAM_VLAN_ENABLED);
 
 static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
                                          struct attribute *attr, int i)
@@ -332,6 +334,10 @@ static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
                param = ISCSI_NET_PARAM_IFACE_ENABLE;
        else if (attr == &dev_attr_iface_vlan.attr)
                param = ISCSI_NET_PARAM_VLAN_ID;
+       else if (attr == &dev_attr_iface_vlan_priority.attr)
+               param = ISCSI_NET_PARAM_VLAN_PRIORITY;
+       else if (attr == &dev_attr_iface_vlan_enabled.attr)
+               param = ISCSI_NET_PARAM_VLAN_ENABLED;
        else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
                if (attr == &dev_attr_ipv4_iface_ipaddress.attr)
                        param = ISCSI_NET_PARAM_IPV4_ADDR;
@@ -367,6 +373,8 @@ static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
 static struct attribute *iscsi_iface_attrs[] = {
        &dev_attr_iface_enabled.attr,
        &dev_attr_iface_vlan.attr,
+       &dev_attr_iface_vlan_priority.attr,
+       &dev_attr_iface_vlan_enabled.attr,
        &dev_attr_ipv4_iface_ipaddress.attr,
        &dev_attr_ipv4_iface_gateway.attr,
        &dev_attr_ipv4_iface_subnet.attr,
index 3753f7e36386ec1b6186a3b9a81c8c878516f26c..d3f256a232f8a5062a95207c74efcf24ce5911d3 100644 (file)
@@ -281,6 +281,13 @@ struct iscsi_path {
 #define ISCSI_IFACE_TYPE_IPV4          0x01
 #define ISCSI_IFACE_TYPE_IPV6          0x02
 
+#define ISCSI_MAX_VLAN_ID              4095
+#define ISCSI_MAX_VLAN_PRIORITY                7
+
+/* iscsi vlan enable/disabled setting */
+#define ISCSI_VLAN_DISABLE     0x01
+#define ISCSI_VLAN_ENABLE      0x02
+
 /* iSCSI network params */
 enum iscsi_net_param {
        ISCSI_NET_PARAM_IPV4_ADDR               = 1,
@@ -296,8 +303,10 @@ enum iscsi_net_param {
        ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG     = 11,
        ISCSI_NET_PARAM_IFACE_ENABLE            = 12,
        ISCSI_NET_PARAM_VLAN_ID                 = 13,
-       ISCSI_NET_PARAM_IFACE_TYPE              = 14,
-       ISCSI_NET_PARAM_IFACE_NAME              = 15,
+       ISCSI_NET_PARAM_VLAN_PRIORITY           = 14,
+       ISCSI_NET_PARAM_VLAN_ENABLED            = 15,
+       ISCSI_NET_PARAM_IFACE_TYPE              = 16,
+       ISCSI_NET_PARAM_IFACE_NAME              = 17,
 };
 
 /*