Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270968
b: refs/heads/master
c: 56c155b
h: refs/heads/master
v: v3
  • Loading branch information
Mike Christie authored and James Bottomley committed Aug 27, 2011
1 parent c6d07b8 commit b6a0eb8
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d7c20b7fa5c6ca19e871b4050e321c99d32bd43
refs/heads/master: 56c155b5ca427c9a6312bb0e31865f1c8ab10b2b
27 changes: 27 additions & 0 deletions trunk/drivers/scsi/scsi_transport_iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,30 @@ iscsi_set_path(struct iscsi_transport *transport, struct iscsi_uevent *ev)
return err;
}

static int
iscsi_set_iface_params(struct iscsi_transport *transport,
struct iscsi_uevent *ev)
{
char *data = (char *)ev + sizeof(*ev);
struct Scsi_Host *shost;
int err;

if (!transport->set_iface_param)
return -ENOSYS;

shost = scsi_host_lookup(ev->u.set_iface_params.host_no);
if (!shost) {
printk(KERN_ERR "set_iface_params could not find host no %u\n",
ev->u.set_iface_params.host_no);
return -ENODEV;
}

err = transport->set_iface_param(shost, data,
ev->u.set_iface_params.count);
scsi_host_put(shost);
return err;
}

static int
iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
{
Expand Down Expand Up @@ -1696,6 +1720,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
case ISCSI_UEVENT_PATH_UPDATE:
err = iscsi_set_path(transport, ev);
break;
case ISCSI_UEVENT_SET_IFACE_PARAMS:
err = iscsi_set_iface_params(transport, ev);
break;
default:
err = -ENOSYS;
break;
Expand Down
63 changes: 63 additions & 0 deletions trunk/include/scsi/iscsi_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ enum iscsi_uevent_e {
ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,

ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,

/* up events */
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
Expand Down Expand Up @@ -172,6 +173,10 @@ struct iscsi_uevent {
struct msg_set_path {
uint32_t host_no;
} set_path;
struct msg_set_iface_params {
uint32_t host_no;
uint32_t count;
} set_iface_params;
} u;
union {
/* messages k -> u */
Expand Down Expand Up @@ -214,6 +219,21 @@ struct iscsi_uevent {
} r;
} __attribute__ ((aligned (sizeof(uint64_t))));

enum iscsi_param_type {
ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */
ISCSI_HOST_PARAM, /* iscsi_host_param */
ISCSI_NET_PARAM, /* iscsi_net_param */
};

struct iscsi_iface_param_info {
uint32_t iface_num; /* iface number, 0 - n */
uint32_t len; /* Actual length of the param */
uint16_t param; /* iscsi param value */
uint8_t iface_type; /* IPv4 or IPv6 */
uint8_t param_type; /* iscsi_param_type */
uint8_t value[0]; /* length sized value follows */
} __packed;

/*
* To keep the struct iscsi_uevent size the same for userspace code
* compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
Expand All @@ -237,6 +257,49 @@ struct iscsi_path {
uint16_t pmtu;
} __attribute__ ((aligned (sizeof(uint64_t))));

/* iscsi iface enabled/disabled setting */
#define ISCSI_IFACE_DISABLE 0x01
#define ISCSI_IFACE_ENABLE 0x02

/* ipv4 bootproto */
#define ISCSI_BOOTPROTO_STATIC 0x01
#define ISCSI_BOOTPROTO_DHCP 0x02

/* ipv6 addr autoconfig type */
#define ISCSI_IPV6_AUTOCFG_DISABLE 0x01
#define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02
#define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03

/* ipv6 link local addr type */
#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01
#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02

/* ipv6 router addr type */
#define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01
#define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02

#define ISCSI_IFACE_TYPE_IPV4 0x01
#define ISCSI_IFACE_TYPE_IPV6 0x02

/* iSCSI network params */
enum iscsi_net_param {
ISCSI_NET_PARAM_IPV4_ADDR = 1,
ISCSI_NET_PARAM_IPV4_SUBNET = 2,
ISCSI_NET_PARAM_IPV4_GW = 3,
ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4,
ISCSI_NET_PARAM_MAC = 5,
ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6,
ISCSI_NET_PARAM_IPV6_ADDR = 7,
ISCSI_NET_PARAM_IPV6_ROUTER = 8,
ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9,
ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10,
ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11,
ISCSI_NET_PARAM_IFACE_ENABLE = 12,
ISCSI_NET_PARAM_VLAN_ID = 13,
ISCSI_NET_IFACE_TYPE = 14,
ISCSI_NET_IFACE_NAME = 15,
};

/*
* Common error codes
*/
Expand Down
1 change: 1 addition & 0 deletions trunk/include/scsi/scsi_transport_iscsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ struct iscsi_transport {
int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type,
uint32_t enable, struct sockaddr *dst_addr);
int (*set_path) (struct Scsi_Host *shost, struct iscsi_path *params);
int (*set_iface_param) (struct Scsi_Host *shost, char *data, int count);
};

/*
Expand Down

0 comments on commit b6a0eb8

Please sign in to comment.