ib_srpt: Rework r4984 (skip Ethernet ports)

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4991 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2013-09-08 10:20:54 +00:00
parent 38a6e069fa
commit 08bfd4c19a

View File

@@ -695,7 +695,6 @@ err:
*/
static int srpt_refresh_port(struct srpt_port *sport)
{
static const union ib_gid zero_gid;
struct ib_mad_reg_req reg_req;
struct ib_port_modify port_modify;
struct ib_port_attr port_attr;
@@ -704,6 +703,15 @@ static int srpt_refresh_port(struct srpt_port *sport)
TRACE_ENTRY();
switch (rdma_port_get_link_layer(sport->sdev->device, sport->port)) {
case IB_LINK_LAYER_UNSPECIFIED:
case IB_LINK_LAYER_INFINIBAND:
break;
case IB_LINK_LAYER_ETHERNET:
default:
return 0;
}
memset(&port_modify, 0, sizeof(port_modify));
port_modify.set_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP;
port_modify.clr_port_cap_mask = 0;
@@ -755,14 +763,8 @@ static int srpt_refresh_port(struct srpt_port *sport)
be16_to_cpu(((__be16 *) sport->gid.raw)[5]),
be16_to_cpu(((__be16 *) sport->gid.raw)[6]),
be16_to_cpu(((__be16 *) sport->gid.raw)[7]));
/*
* Skip target registration if the port mode has been changed
* from IB into Ethernet after the add_client() callback
* started and before the port GID has been queried.
*/
if (memcmp(&sport->gid, &zero_gid, sizeof(zero_gid)) != 0)
sport->srpt_tgt.scst_tgt =
scst_register_target(&srpt_template, tgt_name);
sport->srpt_tgt.scst_tgt = scst_register_target(&srpt_template,
tgt_name);
if (sport->srpt_tgt.scst_tgt)
scst_tgt_set_tgt_priv(sport->srpt_tgt.scst_tgt, sport);
else