Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28127
b: refs/heads/master
c: 647dcb5
h: refs/heads/master
i:
  28125: 9292988
  28123: 39de504
  28119: 6c19542
  28111: ea1580e
  28095: 5a2e1db
v: v3
  • Loading branch information
Ben Collins committed Jun 12, 2006
1 parent 823fd41 commit ed9c221
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 57fdb58fa5a140bdd52cf4c4ffc30df73676f0a5
refs/heads/master: 647dcb5fae0ebb5da1272ed2773df0d3f152c303
6 changes: 2 additions & 4 deletions trunk/drivers/ieee1394/eth1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,8 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)

/* Determine speed limit */
for (i = 0; i < host->node_count; i++)
if (max_speed > host->speed_map[NODEID_TO_NODE(host->node_id) *
64 + i])
max_speed = host->speed_map[NODEID_TO_NODE(host->node_id) *
64 + i];
if (max_speed > host->speed[i])
max_speed = host->speed[i];
priv->bc_sspd = max_speed;

/* We'll use our maxpayload as the default mtu */
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/ieee1394/hosts.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ struct hpsb_host {

unsigned char iso_listen_count[64];

int node_count; /* number of identified nodes on this bus */
int selfid_count; /* total number of SelfIDs received */
int nodes_active; /* number of nodes that are actually active */
int node_count; /* number of identified nodes on this bus */
int selfid_count; /* total number of SelfIDs received */
int nodes_active; /* number of nodes with active link layer */
u8 speed[63]; /* speed between each node and local node */

nodeid_t node_id; /* node ID of this host */
nodeid_t irm_id; /* ID of this bus' isochronous resource manager */
nodeid_t node_id; /* node ID of this host */
nodeid_t irm_id; /* ID of this bus' isochronous resource manager */
nodeid_t busmgr_id; /* ID of this bus' bus manager */

/* this nodes state */
Expand Down
14 changes: 9 additions & 5 deletions trunk/drivers/ieee1394/ieee1394_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ static int check_selfids(struct hpsb_host *host)

static void build_speed_map(struct hpsb_host *host, int nodecount)
{
u8 speedcap[nodecount];
u8 cldcnt[nodecount];
u8 *map = host->speed_map;
u8 *speedcap = host->speed;
struct selfid *sid;
struct ext_selfid *esid;
int i, j, n;
Expand Down Expand Up @@ -354,6 +354,11 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
}
}
}

/* assume maximum speed for 1394b PHYs, nodemgr will correct it */
for (n = 0; n < nodecount; n++)
if (speedcap[n] == 3)
speedcap[n] = IEEE1394_SPEED_MAX;
}


Expand Down Expand Up @@ -554,11 +559,10 @@ int hpsb_send_packet(struct hpsb_packet *packet)
return 0;
}

if (packet->type == hpsb_async && packet->node_id != ALL_NODES) {
if (packet->type == hpsb_async &&
NODEID_TO_NODE(packet->node_id) != ALL_NODES)
packet->speed_code =
host->speed_map[NODEID_TO_NODE(host->node_id) * 64
+ NODEID_TO_NODE(packet->node_id)];
}
host->speed[NODEID_TO_NODE(packet->node_id)];

dump_packet("send packet", packet->header, packet->header_size, packet->speed_code);

Expand Down
61 changes: 58 additions & 3 deletions trunk/drivers/ieee1394/nodemgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct nodemgr_csr_info {
struct hpsb_host *host;
nodeid_t nodeid;
unsigned int generation;
unsigned int speed_unverified:1;
};


Expand All @@ -57,23 +58,75 @@ static char *nodemgr_find_oui_name(int oui)
return NULL;
}

/*
* Correct the speed map entry. This is necessary
* - for nodes with link speed < phy speed,
* - for 1394b nodes with negotiated phy port speed < IEEE1394_SPEED_MAX.
* A possible speed is determined by trial and error, using quadlet reads.
*/
static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr,
quadlet_t *buffer)
{
quadlet_t q;
u8 i, *speed, old_speed, good_speed;
int ret;

speed = ci->host->speed + NODEID_TO_NODE(ci->nodeid);
old_speed = *speed;
good_speed = IEEE1394_SPEED_MAX + 1;

/* Try every speed from S100 to old_speed.
* If we did it the other way around, a too low speed could be caught
* if the retry succeeded for some other reason, e.g. because the link
* just finished its initialization. */
for (i = IEEE1394_SPEED_100; i <= old_speed; i++) {
*speed = i;
ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
&q, sizeof(quadlet_t));
if (ret)
break;
*buffer = q;
good_speed = i;
}
if (good_speed <= IEEE1394_SPEED_MAX) {
HPSB_DEBUG("Speed probe of node " NODE_BUS_FMT " yields %s",
NODE_BUS_ARGS(ci->host, ci->nodeid),
hpsb_speedto_str[good_speed]);
*speed = good_speed;
ci->speed_unverified = 0;
return 0;
}
*speed = old_speed;
return ret;
}

static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
void *buffer, void *__ci)
{
struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci;
int i, ret = 0;
int i, ret;

for (i = 1; ; i++) {
ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
buffer, length);
if (!ret || i == 3)
if (!ret) {
ci->speed_unverified = 0;
break;
}
/* Give up after 3rd failure. */
if (i == 3)
break;

/* The ieee1394_core guessed the node's speed capability from
* the self ID. Check whether a lower speed works. */
if (ci->speed_unverified && length == sizeof(quadlet_t)) {
ret = nodemgr_check_speed(ci, addr, buffer);
if (!ret)
break;
}
if (msleep_interruptible(334))
return -EINTR;
}

return ret;
}

Expand Down Expand Up @@ -1204,6 +1257,8 @@ static void nodemgr_node_scan_one(struct host_info *hi,
ci->host = host;
ci->nodeid = nodeid;
ci->generation = generation;
ci->speed_unverified =
host->speed[NODEID_TO_NODE(nodeid)] > IEEE1394_SPEED_100;

/* We need to detect when the ConfigROM's generation has changed,
* so we only update the node's info when it needs to be. */
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/ieee1394/sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,10 +1664,8 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)

SBP2_DEBUG_ENTER();

/* Initial setting comes from the hosts speed map */
scsi_id->speed_code =
hi->host->speed_map[NODEID_TO_NODE(hi->host->node_id) * 64 +
NODEID_TO_NODE(scsi_id->ne->nodeid)];
hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)];

/* Bump down our speed if the user requested it */
if (scsi_id->speed_code > max_speed) {
Expand Down

0 comments on commit ed9c221

Please sign in to comment.