Commit b78dbba0 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] iscsi class: remove iface param mask

We can replace the iface param mask with the
attr_is_visible callback.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 1d063c17
...@@ -141,17 +141,6 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { ...@@ -141,17 +141,6 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
.host_param_mask = ISCSI_HOST_HWADDRESS | .host_param_mask = ISCSI_HOST_HWADDRESS |
ISCSI_HOST_IPADDRESS | ISCSI_HOST_IPADDRESS |
ISCSI_HOST_INITIATOR_NAME, ISCSI_HOST_INITIATOR_NAME,
.iface_param_mask = ISCSI_NET_IPV4_ADDR |
ISCSI_NET_IPV4_SUBNET |
ISCSI_NET_IPV4_GW |
ISCSI_NET_IPV4_BOOTPROTO |
ISCSI_NET_IFACE_ENABLE |
ISCSI_NET_IPV6_LINKLOCAL |
ISCSI_NET_IPV6_ADDR |
ISCSI_NET_IPV6_ROUTER |
ISCSI_NET_IPV6_ADDR_AUTOCFG |
ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG |
ISCSI_NET_IFACE_ENABLE,
.tgt_dscvr = qla4xxx_tgt_dscvr, .tgt_dscvr = qla4xxx_tgt_dscvr,
.attr_is_visible = ql4_attr_is_visible, .attr_is_visible = ql4_attr_is_visible,
.get_conn_param = qla4xxx_conn_get_param, .get_conn_param = qla4xxx_conn_get_param,
...@@ -178,6 +167,22 @@ static mode_t ql4_attr_is_visible(int param_type, int param) ...@@ -178,6 +167,22 @@ static mode_t ql4_attr_is_visible(int param_type, int param)
default: default:
return 0; return 0;
} }
case ISCSI_NET_PARAM:
switch (param) {
case ISCSI_NET_PARAM_IPV4_ADDR:
case ISCSI_NET_PARAM_IPV4_SUBNET:
case ISCSI_NET_PARAM_IPV4_GW:
case ISCSI_NET_PARAM_IPV4_BOOTPROTO:
case ISCSI_NET_PARAM_IFACE_ENABLE:
case ISCSI_NET_PARAM_IPV6_LINKLOCAL:
case ISCSI_NET_PARAM_IPV6_ADDR:
case ISCSI_NET_PARAM_IPV6_ROUTER:
case ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG:
case ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG:
return S_IRUGO;
default:
return 0;
}
} }
return 0; return 0;
......
...@@ -329,45 +329,42 @@ static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj, ...@@ -329,45 +329,42 @@ static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
struct device *dev = container_of(kobj, struct device, kobj); struct device *dev = container_of(kobj, struct device, kobj);
struct iscsi_iface *iface = iscsi_dev_to_iface(dev); struct iscsi_iface *iface = iscsi_dev_to_iface(dev);
struct iscsi_transport *t = iface->transport; struct iscsi_transport *t = iface->transport;
int param;
if (attr == &dev_attr_iface_enabled.attr) if (attr == &dev_attr_iface_enabled.attr)
return (t->iface_param_mask & ISCSI_NET_IFACE_ENABLE) ? param = ISCSI_NET_PARAM_IFACE_ENABLE;
S_IRUGO : 0;
else if (attr == &dev_attr_iface_vlan.attr) else if (attr == &dev_attr_iface_vlan.attr)
return (t->iface_param_mask & ISCSI_NET_VLAN_ID) ? S_IRUGO : 0; param = ISCSI_NET_PARAM_VLAN_ID;
else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) {
if (attr == &dev_attr_ipv4_iface_ipaddress.attr) if (attr == &dev_attr_ipv4_iface_ipaddress.attr)
return (t->iface_param_mask & ISCSI_NET_IPV4_ADDR) ? param = ISCSI_NET_PARAM_IPV4_ADDR;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv4_iface_gateway.attr) else if (attr == &dev_attr_ipv4_iface_gateway.attr)
return (t->iface_param_mask & ISCSI_NET_IPV4_GW) ? param = ISCSI_NET_PARAM_IPV4_GW;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv4_iface_subnet.attr) else if (attr == &dev_attr_ipv4_iface_subnet.attr)
return (t->iface_param_mask & ISCSI_NET_IPV4_SUBNET) ? param = ISCSI_NET_PARAM_IPV4_SUBNET;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv4_iface_bootproto.attr) else if (attr == &dev_attr_ipv4_iface_bootproto.attr)
return (t->iface_param_mask & ISCSI_NET_IPV4_BOOTPROTO) ? param = ISCSI_NET_PARAM_IPV4_BOOTPROTO;
S_IRUGO : 0; else
return 0;
} else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) { } else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) {
if (attr == &dev_attr_ipv6_iface_ipaddress.attr) if (attr == &dev_attr_ipv6_iface_ipaddress.attr)
return (t->iface_param_mask & ISCSI_NET_IPV6_ADDR) ? param = ISCSI_NET_PARAM_IPV6_ADDR;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv6_iface_link_local_addr.attr) else if (attr == &dev_attr_ipv6_iface_link_local_addr.attr)
return (t->iface_param_mask & ISCSI_NET_IPV6_LINKLOCAL) ? param = ISCSI_NET_PARAM_IPV6_LINKLOCAL;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv6_iface_router_addr.attr) else if (attr == &dev_attr_ipv6_iface_router_addr.attr)
return (t->iface_param_mask & ISCSI_NET_IPV6_ROUTER) ? param = ISCSI_NET_PARAM_IPV6_ROUTER;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv6_iface_ipaddr_autocfg.attr) else if (attr == &dev_attr_ipv6_iface_ipaddr_autocfg.attr)
return (t->iface_param_mask & ISCSI_NET_IPV6_ADDR_AUTOCFG) ? param = ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG;
S_IRUGO : 0;
else if (attr == &dev_attr_ipv6_iface_linklocal_autocfg.attr) else if (attr == &dev_attr_ipv6_iface_linklocal_autocfg.attr)
return (t->iface_param_mask & ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG) ? param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG;
S_IRUGO : 0; else
return 0;
} else {
WARN_ONCE(1, "Invalid iface attr");
return 0;
} }
return 0; return t->attr_is_visible(ISCSI_NET_PARAM, param);
} }
static struct attribute *iscsi_iface_attrs[] = { static struct attribute *iscsi_iface_attrs[] = {
......
...@@ -300,23 +300,6 @@ enum iscsi_net_param { ...@@ -300,23 +300,6 @@ enum iscsi_net_param {
ISCSI_NET_PARAM_IFACE_NAME = 15, ISCSI_NET_PARAM_IFACE_NAME = 15,
}; };
#define ISCSI_NET_IPV4_ADDR (1ULL << ISCSI_NET_PARAM_IPV4_ADDR)
#define ISCSI_NET_IPV4_SUBNET (1ULL << ISCSI_NET_PARAM_IPV4_SUBNET)
#define ISCSI_NET_IPV4_GW (1ULL << ISCSI_NET_PARAM_IPV4_GW)
#define ISCSI_NET_IPV4_BOOTPROTO (1ULL << ISCSI_NET_PARAM_IPV4_BOOTPROTO)
#define ISCSI_NET_MAC (1ULL << ISCSI_NET_PARAM_MAC)
#define ISCSI_NET_IPV6_LINKLOCAL (1ULL << ISCSI_NET_PARAM_IPV6_LINKLOCAL)
#define ISCSI_NET_IPV6_ADDR (1ULL << ISCSI_NET_PARAM_IPV6_ADDR)
#define ISCSI_NET_IPV6_ROUTER (1ULL << ISCSI_NET_PARAM_IPV6_ROUTER)
#define ISCSI_NET_IPV6_ADDR_AUTOCFG \
(1ULL << ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG)
#define ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG \
(1ULL << ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG)
#define ISCSI_NET_IPV6_ROUTER_AUTOCFG \
(1ULL << ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG)
#define ISCSI_NET_IFACE_ENABLE (1ULL << ISCSI_NET_PARAM_IFACE_ENABLE)
#define ISCSI_NET_VLAN_ID (1ULL << ISCSI_NET_PARAM_VLAN_ID)
/* /*
* Common error codes * Common error codes
*/ */
......
...@@ -87,7 +87,6 @@ struct iscsi_transport { ...@@ -87,7 +87,6 @@ struct iscsi_transport {
unsigned int caps; unsigned int caps;
/* LLD sets this to indicate what values it can export to sysfs */ /* LLD sets this to indicate what values it can export to sysfs */
uint64_t host_param_mask; uint64_t host_param_mask;
uint64_t iface_param_mask;
struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep, struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep,
uint16_t cmds_max, uint16_t qdepth, uint16_t cmds_max, uint16_t qdepth,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment