diff options
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 87 |
1 files changed, 59 insertions, 28 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 83fa32f72398..9de2d38a5321 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -558,12 +558,12 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param) | |||
558 | u32 qp_token; | 558 | u32 qp_token; |
559 | 559 | ||
560 | eqe = ehea_poll_eq(port->qp_eq); | 560 | eqe = ehea_poll_eq(port->qp_eq); |
561 | ehea_debug("eqe=%p", eqe); | 561 | |
562 | while (eqe) { | 562 | while (eqe) { |
563 | ehea_debug("*eqe=%lx", *(u64*)eqe); | ||
564 | eqe = ehea_poll_eq(port->qp_eq); | ||
565 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); | 563 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); |
566 | ehea_debug("next eqe=%p", eqe); | 564 | ehea_error("QP aff_err: entry=0x%lx, token=0x%x", |
565 | eqe->entry, qp_token); | ||
566 | eqe = ehea_poll_eq(port->qp_eq); | ||
567 | } | 567 | } |
568 | 568 | ||
569 | return IRQ_HANDLED; | 569 | return IRQ_HANDLED; |
@@ -575,8 +575,9 @@ static struct ehea_port *ehea_get_port(struct ehea_adapter *adapter, | |||
575 | int i; | 575 | int i; |
576 | 576 | ||
577 | for (i = 0; i < adapter->num_ports; i++) | 577 | for (i = 0; i < adapter->num_ports; i++) |
578 | if (adapter->port[i]->logical_port_id == logical_port) | 578 | if (adapter->port[i]) |
579 | return adapter->port[i]; | 579 | if (adapter->port[i]->logical_port_id == logical_port) |
580 | return adapter->port[i]; | ||
580 | return NULL; | 581 | return NULL; |
581 | } | 582 | } |
582 | 583 | ||
@@ -642,6 +643,8 @@ int ehea_sense_port_attr(struct ehea_port *port) | |||
642 | break; | 643 | break; |
643 | } | 644 | } |
644 | 645 | ||
646 | port->autoneg = 1; | ||
647 | |||
645 | /* Number of default QPs */ | 648 | /* Number of default QPs */ |
646 | port->num_def_qps = cb0->num_default_qps; | 649 | port->num_def_qps = cb0->num_default_qps; |
647 | 650 | ||
@@ -728,10 +731,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed) | |||
728 | } | 731 | } |
729 | } else { | 732 | } else { |
730 | if (hret == H_AUTHORITY) { | 733 | if (hret == H_AUTHORITY) { |
731 | ehea_info("Hypervisor denied setting port speed. Either" | 734 | ehea_info("Hypervisor denied setting port speed"); |
732 | " this partition is not authorized to set " | ||
733 | "port speed or another partition has modified" | ||
734 | " port speed first."); | ||
735 | ret = -EPERM; | 735 | ret = -EPERM; |
736 | } else { | 736 | } else { |
737 | ret = -EIO; | 737 | ret = -EIO; |
@@ -998,7 +998,7 @@ static int ehea_configure_port(struct ehea_port *port) | |||
998 | | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1); | 998 | | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1); |
999 | 999 | ||
1000 | for (i = 0; i < port->num_def_qps; i++) | 1000 | for (i = 0; i < port->num_def_qps; i++) |
1001 | cb0->default_qpn_arr[i] = port->port_res[i].qp->init_attr.qp_nr; | 1001 | cb0->default_qpn_arr[i] = port->port_res[0].qp->init_attr.qp_nr; |
1002 | 1002 | ||
1003 | if (netif_msg_ifup(port)) | 1003 | if (netif_msg_ifup(port)) |
1004 | ehea_dump(cb0, sizeof(*cb0), "ehea_configure_port"); | 1004 | ehea_dump(cb0, sizeof(*cb0), "ehea_configure_port"); |
@@ -1485,11 +1485,12 @@ out: | |||
1485 | 1485 | ||
1486 | static void ehea_promiscuous_error(u64 hret, int enable) | 1486 | static void ehea_promiscuous_error(u64 hret, int enable) |
1487 | { | 1487 | { |
1488 | ehea_info("Hypervisor denied %sabling promiscuous mode.%s", | 1488 | if (hret == H_AUTHORITY) |
1489 | enable == 1 ? "en" : "dis", | 1489 | ehea_info("Hypervisor denied %sabling promiscuous mode", |
1490 | hret != H_AUTHORITY ? "" : " Another partition owning a " | 1490 | enable == 1 ? "en" : "dis"); |
1491 | "logical port on the same physical port might have altered " | 1491 | else |
1492 | "promiscuous mode first."); | 1492 | ehea_error("failed %sabling promiscuous mode", |
1493 | enable == 1 ? "en" : "dis"); | ||
1493 | } | 1494 | } |
1494 | 1495 | ||
1495 | static void ehea_promiscuous(struct net_device *dev, int enable) | 1496 | static void ehea_promiscuous(struct net_device *dev, int enable) |
@@ -2267,6 +2268,8 @@ static void ehea_tx_watchdog(struct net_device *dev) | |||
2267 | int ehea_sense_adapter_attr(struct ehea_adapter *adapter) | 2268 | int ehea_sense_adapter_attr(struct ehea_adapter *adapter) |
2268 | { | 2269 | { |
2269 | struct hcp_query_ehea *cb; | 2270 | struct hcp_query_ehea *cb; |
2271 | struct device_node *lhea_dn = NULL; | ||
2272 | struct device_node *eth_dn = NULL; | ||
2270 | u64 hret; | 2273 | u64 hret; |
2271 | int ret; | 2274 | int ret; |
2272 | 2275 | ||
@@ -2283,7 +2286,18 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter) | |||
2283 | goto out_herr; | 2286 | goto out_herr; |
2284 | } | 2287 | } |
2285 | 2288 | ||
2286 | adapter->num_ports = cb->num_ports; | 2289 | /* Determine the number of available logical ports |
2290 | * by counting the child nodes of the lhea OFDT entry | ||
2291 | */ | ||
2292 | adapter->num_ports = 0; | ||
2293 | lhea_dn = of_find_node_by_name(lhea_dn, "lhea"); | ||
2294 | do { | ||
2295 | eth_dn = of_get_next_child(lhea_dn, eth_dn); | ||
2296 | if (eth_dn) | ||
2297 | adapter->num_ports++; | ||
2298 | } while ( eth_dn ); | ||
2299 | of_node_put(lhea_dn); | ||
2300 | |||
2287 | adapter->max_mc_mac = cb->max_mc_mac - 1; | 2301 | adapter->max_mc_mac = cb->max_mc_mac - 1; |
2288 | ret = 0; | 2302 | ret = 0; |
2289 | 2303 | ||
@@ -2302,6 +2316,7 @@ static int ehea_setup_single_port(struct ehea_port *port, | |||
2302 | struct ehea_adapter *adapter = port->adapter; | 2316 | struct ehea_adapter *adapter = port->adapter; |
2303 | struct hcp_ehea_port_cb4 *cb4; | 2317 | struct hcp_ehea_port_cb4 *cb4; |
2304 | u32 *dn_log_port_id; | 2318 | u32 *dn_log_port_id; |
2319 | int jumbo = 0; | ||
2305 | 2320 | ||
2306 | sema_init(&port->port_lock, 1); | 2321 | sema_init(&port->port_lock, 1); |
2307 | port->state = EHEA_PORT_DOWN; | 2322 | port->state = EHEA_PORT_DOWN; |
@@ -2334,8 +2349,6 @@ static int ehea_setup_single_port(struct ehea_port *port, | |||
2334 | 2349 | ||
2335 | INIT_LIST_HEAD(&port->mc_list->list); | 2350 | INIT_LIST_HEAD(&port->mc_list->list); |
2336 | 2351 | ||
2337 | ehea_set_portspeed(port, EHEA_SPEED_AUTONEG); | ||
2338 | |||
2339 | ret = ehea_sense_port_attr(port); | 2352 | ret = ehea_sense_port_attr(port); |
2340 | if (ret) | 2353 | if (ret) |
2341 | goto out; | 2354 | goto out; |
@@ -2345,13 +2358,25 @@ static int ehea_setup_single_port(struct ehea_port *port, | |||
2345 | if (!cb4) { | 2358 | if (!cb4) { |
2346 | ehea_error("no mem for cb4"); | 2359 | ehea_error("no mem for cb4"); |
2347 | } else { | 2360 | } else { |
2348 | cb4->jumbo_frame = 1; | 2361 | hret = ehea_h_query_ehea_port(adapter->handle, |
2349 | hret = ehea_h_modify_ehea_port(adapter->handle, | 2362 | port->logical_port_id, |
2350 | port->logical_port_id, | 2363 | H_PORT_CB4, |
2351 | H_PORT_CB4, H_PORT_CB4_JUMBO, | 2364 | H_PORT_CB4_JUMBO, cb4); |
2352 | cb4); | 2365 | |
2353 | if (hret != H_SUCCESS) { | 2366 | if (hret == H_SUCCESS) { |
2354 | ehea_info("Jumbo frames not activated"); | 2367 | if (cb4->jumbo_frame) |
2368 | jumbo = 1; | ||
2369 | else { | ||
2370 | cb4->jumbo_frame = 1; | ||
2371 | hret = ehea_h_modify_ehea_port(adapter->handle, | ||
2372 | port-> | ||
2373 | logical_port_id, | ||
2374 | H_PORT_CB4, | ||
2375 | H_PORT_CB4_JUMBO, | ||
2376 | cb4); | ||
2377 | if (hret == H_SUCCESS) | ||
2378 | jumbo = 1; | ||
2379 | } | ||
2355 | } | 2380 | } |
2356 | kfree(cb4); | 2381 | kfree(cb4); |
2357 | } | 2382 | } |
@@ -2390,6 +2415,9 @@ static int ehea_setup_single_port(struct ehea_port *port, | |||
2390 | goto out_free; | 2415 | goto out_free; |
2391 | } | 2416 | } |
2392 | 2417 | ||
2418 | ehea_info("%s: Jumbo frames are %sabled", dev->name, | ||
2419 | jumbo == 1 ? "en" : "dis"); | ||
2420 | |||
2393 | port->netdev = dev; | 2421 | port->netdev = dev; |
2394 | ret = 0; | 2422 | ret = 0; |
2395 | goto out; | 2423 | goto out; |
@@ -2471,14 +2499,16 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev, | |||
2471 | 2499 | ||
2472 | adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", | 2500 | adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", |
2473 | NULL); | 2501 | NULL); |
2474 | if (!adapter_handle) { | 2502 | if (adapter_handle) |
2503 | adapter->handle = *adapter_handle; | ||
2504 | |||
2505 | if (!adapter->handle) { | ||
2475 | dev_err(&dev->ofdev.dev, "failed getting handle for adapter" | 2506 | dev_err(&dev->ofdev.dev, "failed getting handle for adapter" |
2476 | " '%s'\n", dev->ofdev.node->full_name); | 2507 | " '%s'\n", dev->ofdev.node->full_name); |
2477 | ret = -ENODEV; | 2508 | ret = -ENODEV; |
2478 | goto out_free_ad; | 2509 | goto out_free_ad; |
2479 | } | 2510 | } |
2480 | 2511 | ||
2481 | adapter->handle = *adapter_handle; | ||
2482 | adapter->pd = EHEA_PD_ID; | 2512 | adapter->pd = EHEA_PD_ID; |
2483 | 2513 | ||
2484 | dev->ofdev.dev.driver_data = adapter; | 2514 | dev->ofdev.dev.driver_data = adapter; |
@@ -2568,6 +2598,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev) | |||
2568 | destroy_workqueue(adapter->ehea_wq); | 2598 | destroy_workqueue(adapter->ehea_wq); |
2569 | 2599 | ||
2570 | ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); | 2600 | ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); |
2601 | tasklet_kill(&adapter->neq_tasklet); | ||
2571 | 2602 | ||
2572 | ehea_destroy_eq(adapter->neq); | 2603 | ehea_destroy_eq(adapter->neq); |
2573 | 2604 | ||