diff options
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r-- | drivers/net/ehea/ehea.h | 6 | ||||
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 92 |
2 files changed, 50 insertions, 48 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index a8d3280923e8..f5dacceab95b 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -422,7 +422,7 @@ struct ehea_fw_handle_entry { | |||
422 | struct ehea_fw_handle_array { | 422 | struct ehea_fw_handle_array { |
423 | struct ehea_fw_handle_entry *arr; | 423 | struct ehea_fw_handle_entry *arr; |
424 | int num_entries; | 424 | int num_entries; |
425 | struct semaphore lock; | 425 | struct mutex lock; |
426 | }; | 426 | }; |
427 | 427 | ||
428 | struct ehea_bcmc_reg_entry { | 428 | struct ehea_bcmc_reg_entry { |
@@ -435,7 +435,7 @@ struct ehea_bcmc_reg_entry { | |||
435 | struct ehea_bcmc_reg_array { | 435 | struct ehea_bcmc_reg_array { |
436 | struct ehea_bcmc_reg_entry *arr; | 436 | struct ehea_bcmc_reg_entry *arr; |
437 | int num_entries; | 437 | int num_entries; |
438 | struct semaphore lock; | 438 | struct mutex lock; |
439 | }; | 439 | }; |
440 | 440 | ||
441 | #define EHEA_PORT_UP 1 | 441 | #define EHEA_PORT_UP 1 |
@@ -453,7 +453,7 @@ struct ehea_port { | |||
453 | struct vlan_group *vgrp; | 453 | struct vlan_group *vgrp; |
454 | struct ehea_eq *qp_eq; | 454 | struct ehea_eq *qp_eq; |
455 | struct work_struct reset_task; | 455 | struct work_struct reset_task; |
456 | struct semaphore port_lock; | 456 | struct mutex port_lock; |
457 | char int_aff_name[EHEA_IRQ_NAME_SIZE]; | 457 | char int_aff_name[EHEA_IRQ_NAME_SIZE]; |
458 | int allmulti; /* Indicates IFF_ALLMULTI state */ | 458 | int allmulti; /* Indicates IFF_ALLMULTI state */ |
459 | int promisc; /* Indicates IFF_PROMISC state */ | 459 | int promisc; /* Indicates IFF_PROMISC state */ |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f460b623c077..9ff7538b7595 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/notifier.h> | 36 | #include <linux/notifier.h> |
37 | #include <linux/reboot.h> | 37 | #include <linux/reboot.h> |
38 | #include <asm/kexec.h> | 38 | #include <asm/kexec.h> |
39 | #include <linux/mutex.h> | ||
39 | 40 | ||
40 | #include <net/ip.h> | 41 | #include <net/ip.h> |
41 | 42 | ||
@@ -99,7 +100,7 @@ static int port_name_cnt; | |||
99 | static LIST_HEAD(adapter_list); | 100 | static LIST_HEAD(adapter_list); |
100 | u64 ehea_driver_flags; | 101 | u64 ehea_driver_flags; |
101 | struct work_struct ehea_rereg_mr_task; | 102 | struct work_struct ehea_rereg_mr_task; |
102 | struct semaphore dlpar_mem_lock; | 103 | static DEFINE_MUTEX(dlpar_mem_lock); |
103 | struct ehea_fw_handle_array ehea_fw_handles; | 104 | struct ehea_fw_handle_array ehea_fw_handles; |
104 | struct ehea_bcmc_reg_array ehea_bcmc_regs; | 105 | struct ehea_bcmc_reg_array ehea_bcmc_regs; |
105 | 106 | ||
@@ -1761,7 +1762,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) | |||
1761 | 1762 | ||
1762 | memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); | 1763 | memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); |
1763 | 1764 | ||
1764 | down(&ehea_bcmc_regs.lock); | 1765 | mutex_lock(&ehea_bcmc_regs.lock); |
1765 | 1766 | ||
1766 | /* Deregister old MAC in pHYP */ | 1767 | /* Deregister old MAC in pHYP */ |
1767 | ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 1768 | ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
@@ -1779,7 +1780,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) | |||
1779 | 1780 | ||
1780 | out_upregs: | 1781 | out_upregs: |
1781 | ehea_update_bcmc_registrations(); | 1782 | ehea_update_bcmc_registrations(); |
1782 | up(&ehea_bcmc_regs.lock); | 1783 | mutex_unlock(&ehea_bcmc_regs.lock); |
1783 | out_free: | 1784 | out_free: |
1784 | kfree(cb0); | 1785 | kfree(cb0); |
1785 | out: | 1786 | out: |
@@ -1941,7 +1942,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1941 | } | 1942 | } |
1942 | ehea_promiscuous(dev, 0); | 1943 | ehea_promiscuous(dev, 0); |
1943 | 1944 | ||
1944 | down(&ehea_bcmc_regs.lock); | 1945 | mutex_lock(&ehea_bcmc_regs.lock); |
1945 | 1946 | ||
1946 | if (dev->flags & IFF_ALLMULTI) { | 1947 | if (dev->flags & IFF_ALLMULTI) { |
1947 | ehea_allmulti(dev, 1); | 1948 | ehea_allmulti(dev, 1); |
@@ -1972,7 +1973,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1972 | } | 1973 | } |
1973 | out: | 1974 | out: |
1974 | ehea_update_bcmc_registrations(); | 1975 | ehea_update_bcmc_registrations(); |
1975 | up(&ehea_bcmc_regs.lock); | 1976 | mutex_unlock(&ehea_bcmc_regs.lock); |
1976 | return; | 1977 | return; |
1977 | } | 1978 | } |
1978 | 1979 | ||
@@ -2455,7 +2456,7 @@ static int ehea_up(struct net_device *dev) | |||
2455 | if (port->state == EHEA_PORT_UP) | 2456 | if (port->state == EHEA_PORT_UP) |
2456 | return 0; | 2457 | return 0; |
2457 | 2458 | ||
2458 | down(&ehea_fw_handles.lock); | 2459 | mutex_lock(&ehea_fw_handles.lock); |
2459 | 2460 | ||
2460 | ret = ehea_port_res_setup(port, port->num_def_qps, | 2461 | ret = ehea_port_res_setup(port, port->num_def_qps, |
2461 | port->num_add_tx_qps); | 2462 | port->num_add_tx_qps); |
@@ -2493,7 +2494,7 @@ static int ehea_up(struct net_device *dev) | |||
2493 | } | 2494 | } |
2494 | } | 2495 | } |
2495 | 2496 | ||
2496 | down(&ehea_bcmc_regs.lock); | 2497 | mutex_lock(&ehea_bcmc_regs.lock); |
2497 | 2498 | ||
2498 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); | 2499 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); |
2499 | if (ret) { | 2500 | if (ret) { |
@@ -2516,10 +2517,10 @@ out: | |||
2516 | ehea_info("Failed starting %s. ret=%i", dev->name, ret); | 2517 | ehea_info("Failed starting %s. ret=%i", dev->name, ret); |
2517 | 2518 | ||
2518 | ehea_update_bcmc_registrations(); | 2519 | ehea_update_bcmc_registrations(); |
2519 | up(&ehea_bcmc_regs.lock); | 2520 | mutex_unlock(&ehea_bcmc_regs.lock); |
2520 | 2521 | ||
2521 | ehea_update_firmware_handles(); | 2522 | ehea_update_firmware_handles(); |
2522 | up(&ehea_fw_handles.lock); | 2523 | mutex_unlock(&ehea_fw_handles.lock); |
2523 | 2524 | ||
2524 | return ret; | 2525 | return ret; |
2525 | } | 2526 | } |
@@ -2545,7 +2546,7 @@ static int ehea_open(struct net_device *dev) | |||
2545 | int ret; | 2546 | int ret; |
2546 | struct ehea_port *port = netdev_priv(dev); | 2547 | struct ehea_port *port = netdev_priv(dev); |
2547 | 2548 | ||
2548 | down(&port->port_lock); | 2549 | mutex_lock(&port->port_lock); |
2549 | 2550 | ||
2550 | if (netif_msg_ifup(port)) | 2551 | if (netif_msg_ifup(port)) |
2551 | ehea_info("enabling port %s", dev->name); | 2552 | ehea_info("enabling port %s", dev->name); |
@@ -2556,7 +2557,7 @@ static int ehea_open(struct net_device *dev) | |||
2556 | netif_start_queue(dev); | 2557 | netif_start_queue(dev); |
2557 | } | 2558 | } |
2558 | 2559 | ||
2559 | up(&port->port_lock); | 2560 | mutex_unlock(&port->port_lock); |
2560 | 2561 | ||
2561 | return ret; | 2562 | return ret; |
2562 | } | 2563 | } |
@@ -2569,18 +2570,18 @@ static int ehea_down(struct net_device *dev) | |||
2569 | if (port->state == EHEA_PORT_DOWN) | 2570 | if (port->state == EHEA_PORT_DOWN) |
2570 | return 0; | 2571 | return 0; |
2571 | 2572 | ||
2572 | down(&ehea_bcmc_regs.lock); | 2573 | mutex_lock(&ehea_fw_handles.lock); |
2574 | |||
2575 | mutex_lock(&ehea_bcmc_regs.lock); | ||
2573 | ehea_drop_multicast_list(dev); | 2576 | ehea_drop_multicast_list(dev); |
2574 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 2577 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
2575 | 2578 | ||
2576 | ehea_free_interrupts(dev); | 2579 | ehea_free_interrupts(dev); |
2577 | 2580 | ||
2578 | down(&ehea_fw_handles.lock); | ||
2579 | |||
2580 | port->state = EHEA_PORT_DOWN; | 2581 | port->state = EHEA_PORT_DOWN; |
2581 | 2582 | ||
2582 | ehea_update_bcmc_registrations(); | 2583 | ehea_update_bcmc_registrations(); |
2583 | up(&ehea_bcmc_regs.lock); | 2584 | mutex_unlock(&ehea_bcmc_regs.lock); |
2584 | 2585 | ||
2585 | ret = ehea_clean_all_portres(port); | 2586 | ret = ehea_clean_all_portres(port); |
2586 | if (ret) | 2587 | if (ret) |
@@ -2588,7 +2589,7 @@ static int ehea_down(struct net_device *dev) | |||
2588 | dev->name, ret); | 2589 | dev->name, ret); |
2589 | 2590 | ||
2590 | ehea_update_firmware_handles(); | 2591 | ehea_update_firmware_handles(); |
2591 | up(&ehea_fw_handles.lock); | 2592 | mutex_unlock(&ehea_fw_handles.lock); |
2592 | 2593 | ||
2593 | return ret; | 2594 | return ret; |
2594 | } | 2595 | } |
@@ -2602,11 +2603,11 @@ static int ehea_stop(struct net_device *dev) | |||
2602 | ehea_info("disabling port %s", dev->name); | 2603 | ehea_info("disabling port %s", dev->name); |
2603 | 2604 | ||
2604 | flush_scheduled_work(); | 2605 | flush_scheduled_work(); |
2605 | down(&port->port_lock); | 2606 | mutex_lock(&port->port_lock); |
2606 | netif_stop_queue(dev); | 2607 | netif_stop_queue(dev); |
2607 | port_napi_disable(port); | 2608 | port_napi_disable(port); |
2608 | ret = ehea_down(dev); | 2609 | ret = ehea_down(dev); |
2609 | up(&port->port_lock); | 2610 | mutex_unlock(&port->port_lock); |
2610 | return ret; | 2611 | return ret; |
2611 | } | 2612 | } |
2612 | 2613 | ||
@@ -2820,7 +2821,7 @@ static void ehea_reset_port(struct work_struct *work) | |||
2820 | struct net_device *dev = port->netdev; | 2821 | struct net_device *dev = port->netdev; |
2821 | 2822 | ||
2822 | port->resets++; | 2823 | port->resets++; |
2823 | down(&port->port_lock); | 2824 | mutex_lock(&port->port_lock); |
2824 | netif_stop_queue(dev); | 2825 | netif_stop_queue(dev); |
2825 | 2826 | ||
2826 | port_napi_disable(port); | 2827 | port_napi_disable(port); |
@@ -2840,7 +2841,7 @@ static void ehea_reset_port(struct work_struct *work) | |||
2840 | 2841 | ||
2841 | netif_wake_queue(dev); | 2842 | netif_wake_queue(dev); |
2842 | out: | 2843 | out: |
2843 | up(&port->port_lock); | 2844 | mutex_unlock(&port->port_lock); |
2844 | return; | 2845 | return; |
2845 | } | 2846 | } |
2846 | 2847 | ||
@@ -2849,7 +2850,7 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2849 | int ret, i; | 2850 | int ret, i; |
2850 | struct ehea_adapter *adapter; | 2851 | struct ehea_adapter *adapter; |
2851 | 2852 | ||
2852 | down(&dlpar_mem_lock); | 2853 | mutex_lock(&dlpar_mem_lock); |
2853 | ehea_info("LPAR memory enlarged - re-initializing driver"); | 2854 | ehea_info("LPAR memory enlarged - re-initializing driver"); |
2854 | 2855 | ||
2855 | list_for_each_entry(adapter, &adapter_list, list) | 2856 | list_for_each_entry(adapter, &adapter_list, list) |
@@ -2857,22 +2858,24 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2857 | /* Shutdown all ports */ | 2858 | /* Shutdown all ports */ |
2858 | for (i = 0; i < EHEA_MAX_PORTS; i++) { | 2859 | for (i = 0; i < EHEA_MAX_PORTS; i++) { |
2859 | struct ehea_port *port = adapter->port[i]; | 2860 | struct ehea_port *port = adapter->port[i]; |
2861 | struct net_device *dev; | ||
2860 | 2862 | ||
2861 | if (port) { | 2863 | if (!port) |
2862 | struct net_device *dev = port->netdev; | 2864 | continue; |
2863 | 2865 | ||
2864 | if (dev->flags & IFF_UP) { | 2866 | dev = port->netdev; |
2865 | down(&port->port_lock); | 2867 | |
2866 | netif_stop_queue(dev); | 2868 | if (dev->flags & IFF_UP) { |
2867 | ehea_flush_sq(port); | 2869 | mutex_lock(&port->port_lock); |
2868 | ret = ehea_stop_qps(dev); | 2870 | netif_stop_queue(dev); |
2869 | if (ret) { | 2871 | ehea_flush_sq(port); |
2870 | up(&port->port_lock); | 2872 | ret = ehea_stop_qps(dev); |
2871 | goto out; | 2873 | if (ret) { |
2872 | } | 2874 | mutex_unlock(&port->port_lock); |
2873 | port_napi_disable(port); | 2875 | goto out; |
2874 | up(&port->port_lock); | ||
2875 | } | 2876 | } |
2877 | port_napi_disable(port); | ||
2878 | mutex_unlock(&port->port_lock); | ||
2876 | } | 2879 | } |
2877 | } | 2880 | } |
2878 | 2881 | ||
@@ -2912,17 +2915,17 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2912 | struct net_device *dev = port->netdev; | 2915 | struct net_device *dev = port->netdev; |
2913 | 2916 | ||
2914 | if (dev->flags & IFF_UP) { | 2917 | if (dev->flags & IFF_UP) { |
2915 | down(&port->port_lock); | 2918 | mutex_lock(&port->port_lock); |
2916 | port_napi_enable(port); | 2919 | port_napi_enable(port); |
2917 | ret = ehea_restart_qps(dev); | 2920 | ret = ehea_restart_qps(dev); |
2918 | if (!ret) | 2921 | if (!ret) |
2919 | netif_wake_queue(dev); | 2922 | netif_wake_queue(dev); |
2920 | up(&port->port_lock); | 2923 | mutex_unlock(&port->port_lock); |
2921 | } | 2924 | } |
2922 | } | 2925 | } |
2923 | } | 2926 | } |
2924 | } | 2927 | } |
2925 | up(&dlpar_mem_lock); | 2928 | mutex_unlock(&dlpar_mem_lock); |
2926 | ehea_info("re-initializing driver complete"); | 2929 | ehea_info("re-initializing driver complete"); |
2927 | out: | 2930 | out: |
2928 | return; | 2931 | return; |
@@ -3083,7 +3086,7 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
3083 | 3086 | ||
3084 | port = netdev_priv(dev); | 3087 | port = netdev_priv(dev); |
3085 | 3088 | ||
3086 | sema_init(&port->port_lock, 1); | 3089 | mutex_init(&port->port_lock); |
3087 | port->state = EHEA_PORT_DOWN; | 3090 | port->state = EHEA_PORT_DOWN; |
3088 | port->sig_comp_iv = sq_entries / 10; | 3091 | port->sig_comp_iv = sq_entries / 10; |
3089 | 3092 | ||
@@ -3362,7 +3365,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, | |||
3362 | ehea_error("Invalid ibmebus device probed"); | 3365 | ehea_error("Invalid ibmebus device probed"); |
3363 | return -EINVAL; | 3366 | return -EINVAL; |
3364 | } | 3367 | } |
3365 | down(&ehea_fw_handles.lock); | 3368 | mutex_lock(&ehea_fw_handles.lock); |
3366 | 3369 | ||
3367 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 3370 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
3368 | if (!adapter) { | 3371 | if (!adapter) { |
@@ -3446,7 +3449,7 @@ out_free_ad: | |||
3446 | 3449 | ||
3447 | out: | 3450 | out: |
3448 | ehea_update_firmware_handles(); | 3451 | ehea_update_firmware_handles(); |
3449 | up(&ehea_fw_handles.lock); | 3452 | mutex_unlock(&ehea_fw_handles.lock); |
3450 | return ret; | 3453 | return ret; |
3451 | } | 3454 | } |
3452 | 3455 | ||
@@ -3465,7 +3468,7 @@ static int __devexit ehea_remove(struct of_device *dev) | |||
3465 | 3468 | ||
3466 | flush_scheduled_work(); | 3469 | flush_scheduled_work(); |
3467 | 3470 | ||
3468 | down(&ehea_fw_handles.lock); | 3471 | mutex_lock(&ehea_fw_handles.lock); |
3469 | 3472 | ||
3470 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); | 3473 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); |
3471 | tasklet_kill(&adapter->neq_tasklet); | 3474 | tasklet_kill(&adapter->neq_tasklet); |
@@ -3476,7 +3479,7 @@ static int __devexit ehea_remove(struct of_device *dev) | |||
3476 | kfree(adapter); | 3479 | kfree(adapter); |
3477 | 3480 | ||
3478 | ehea_update_firmware_handles(); | 3481 | ehea_update_firmware_handles(); |
3479 | up(&ehea_fw_handles.lock); | 3482 | mutex_unlock(&ehea_fw_handles.lock); |
3480 | 3483 | ||
3481 | return 0; | 3484 | return 0; |
3482 | } | 3485 | } |
@@ -3563,9 +3566,8 @@ int __init ehea_module_init(void) | |||
3563 | memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles)); | 3566 | memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles)); |
3564 | memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); | 3567 | memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); |
3565 | 3568 | ||
3566 | sema_init(&dlpar_mem_lock, 1); | 3569 | mutex_init(&ehea_fw_handles.lock); |
3567 | sema_init(&ehea_fw_handles.lock, 1); | 3570 | mutex_init(&ehea_bcmc_regs.lock); |
3568 | sema_init(&ehea_bcmc_regs.lock, 1); | ||
3569 | 3571 | ||
3570 | ret = check_module_parm(); | 3572 | ret = check_module_parm(); |
3571 | if (ret) | 3573 | if (ret) |