aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea/ehea_main.c
diff options
context:
space:
mode:
authorThomas Klein <osstklei@de.ibm.com>2007-01-22 06:53:50 -0500
committerJeff Garzik <jeff@garzik.org>2007-01-23 00:59:20 -0500
commit4e996b32e0585756c335b35980dc68852c33f297 (patch)
tree0f6227b3102e0de5f6108364356f6698613b7fe9 /drivers/net/ehea/ehea_main.c
parente919b5938b11e1d48a6dcdcb2860e890a954f10d (diff)
ehea: New method to determine number of available ports
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>
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r--drivers/net/ehea/ehea_main.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index d84d0950b658..9486e0a8ec8b 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2269,6 +2269,8 @@ static void ehea_tx_watchdog(struct net_device *dev)
2269int ehea_sense_adapter_attr(struct ehea_adapter *adapter) 2269int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
2270{ 2270{
2271 struct hcp_query_ehea *cb; 2271 struct hcp_query_ehea *cb;
2272 struct device_node *lhea_dn = NULL;
2273 struct device_node *eth_dn = NULL;
2272 u64 hret; 2274 u64 hret;
2273 int ret; 2275 int ret;
2274 2276
@@ -2285,7 +2287,18 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
2285 goto out_herr; 2287 goto out_herr;
2286 } 2288 }
2287 2289
2288 adapter->num_ports = cb->num_ports; 2290 /* Determine the number of available logical ports
2291 * by counting the child nodes of the lhea OFDT entry
2292 */
2293 adapter->num_ports = 0;
2294 lhea_dn = of_find_node_by_name(lhea_dn, "lhea");
2295 do {
2296 eth_dn = of_get_next_child(lhea_dn, eth_dn);
2297 if (eth_dn)
2298 adapter->num_ports++;
2299 } while ( eth_dn );
2300 of_node_put(lhea_dn);
2301
2289 adapter->max_mc_mac = cb->max_mc_mac - 1; 2302 adapter->max_mc_mac = cb->max_mc_mac - 1;
2290 ret = 0; 2303 ret = 0;
2291 2304