Skip to content

Commit

Permalink
ehea: New method to determine number of available ports
Browse files Browse the repository at this point in the history
Count OFDT nodes to determine the number of available ports
instead of using the possibly outdated value from the hypervisor

Signed-off-by: Thomas Klein <tklein@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Thomas Klein authored and Jeff Garzik committed Jan 23, 2007
1 parent e919b59 commit 4e996b3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/net/ehea/ehea_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,8 @@ static void ehea_tx_watchdog(struct net_device *dev)
int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
{
struct hcp_query_ehea *cb;
struct device_node *lhea_dn = NULL;
struct device_node *eth_dn = NULL;
u64 hret;
int ret;

Expand All @@ -2285,7 +2287,18 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
goto out_herr;
}

adapter->num_ports = cb->num_ports;
/* Determine the number of available logical ports
* by counting the child nodes of the lhea OFDT entry
*/
adapter->num_ports = 0;
lhea_dn = of_find_node_by_name(lhea_dn, "lhea");
do {
eth_dn = of_get_next_child(lhea_dn, eth_dn);
if (eth_dn)
adapter->num_ports++;
} while ( eth_dn );
of_node_put(lhea_dn);

adapter->max_mc_mac = cb->max_mc_mac - 1;
ret = 0;

Expand Down

0 comments on commit 4e996b3

Please sign in to comment.