diff options
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 171a08caf2be..0c7811faf72c 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -467,7 +467,8 @@ int be_cmd_fw_init(struct be_adapter *adapter) | |||
467 | u8 *wrb; | 467 | u8 *wrb; |
468 | int status; | 468 | int status; |
469 | 469 | ||
470 | spin_lock(&adapter->mbox_lock); | 470 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
471 | return -1; | ||
471 | 472 | ||
472 | wrb = (u8 *)wrb_from_mbox(adapter); | 473 | wrb = (u8 *)wrb_from_mbox(adapter); |
473 | *wrb++ = 0xFF; | 474 | *wrb++ = 0xFF; |
@@ -481,7 +482,7 @@ int be_cmd_fw_init(struct be_adapter *adapter) | |||
481 | 482 | ||
482 | status = be_mbox_notify_wait(adapter); | 483 | status = be_mbox_notify_wait(adapter); |
483 | 484 | ||
484 | spin_unlock(&adapter->mbox_lock); | 485 | mutex_unlock(&adapter->mbox_lock); |
485 | return status; | 486 | return status; |
486 | } | 487 | } |
487 | 488 | ||
@@ -496,7 +497,8 @@ int be_cmd_fw_clean(struct be_adapter *adapter) | |||
496 | if (adapter->eeh_err) | 497 | if (adapter->eeh_err) |
497 | return -EIO; | 498 | return -EIO; |
498 | 499 | ||
499 | spin_lock(&adapter->mbox_lock); | 500 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
501 | return -1; | ||
500 | 502 | ||
501 | wrb = (u8 *)wrb_from_mbox(adapter); | 503 | wrb = (u8 *)wrb_from_mbox(adapter); |
502 | *wrb++ = 0xFF; | 504 | *wrb++ = 0xFF; |
@@ -510,7 +512,7 @@ int be_cmd_fw_clean(struct be_adapter *adapter) | |||
510 | 512 | ||
511 | status = be_mbox_notify_wait(adapter); | 513 | status = be_mbox_notify_wait(adapter); |
512 | 514 | ||
513 | spin_unlock(&adapter->mbox_lock); | 515 | mutex_unlock(&adapter->mbox_lock); |
514 | return status; | 516 | return status; |
515 | } | 517 | } |
516 | int be_cmd_eq_create(struct be_adapter *adapter, | 518 | int be_cmd_eq_create(struct be_adapter *adapter, |
@@ -521,7 +523,8 @@ int be_cmd_eq_create(struct be_adapter *adapter, | |||
521 | struct be_dma_mem *q_mem = &eq->dma_mem; | 523 | struct be_dma_mem *q_mem = &eq->dma_mem; |
522 | int status; | 524 | int status; |
523 | 525 | ||
524 | spin_lock(&adapter->mbox_lock); | 526 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
527 | return -1; | ||
525 | 528 | ||
526 | wrb = wrb_from_mbox(adapter); | 529 | wrb = wrb_from_mbox(adapter); |
527 | req = embedded_payload(wrb); | 530 | req = embedded_payload(wrb); |
@@ -551,7 +554,7 @@ int be_cmd_eq_create(struct be_adapter *adapter, | |||
551 | eq->created = true; | 554 | eq->created = true; |
552 | } | 555 | } |
553 | 556 | ||
554 | spin_unlock(&adapter->mbox_lock); | 557 | mutex_unlock(&adapter->mbox_lock); |
555 | return status; | 558 | return status; |
556 | } | 559 | } |
557 | 560 | ||
@@ -563,7 +566,8 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | |||
563 | struct be_cmd_req_mac_query *req; | 566 | struct be_cmd_req_mac_query *req; |
564 | int status; | 567 | int status; |
565 | 568 | ||
566 | spin_lock(&adapter->mbox_lock); | 569 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
570 | return -1; | ||
567 | 571 | ||
568 | wrb = wrb_from_mbox(adapter); | 572 | wrb = wrb_from_mbox(adapter); |
569 | req = embedded_payload(wrb); | 573 | req = embedded_payload(wrb); |
@@ -588,7 +592,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | |||
588 | memcpy(mac_addr, resp->mac.addr, ETH_ALEN); | 592 | memcpy(mac_addr, resp->mac.addr, ETH_ALEN); |
589 | } | 593 | } |
590 | 594 | ||
591 | spin_unlock(&adapter->mbox_lock); | 595 | mutex_unlock(&adapter->mbox_lock); |
592 | return status; | 596 | return status; |
593 | } | 597 | } |
594 | 598 | ||
@@ -672,7 +676,8 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
672 | void *ctxt; | 676 | void *ctxt; |
673 | int status; | 677 | int status; |
674 | 678 | ||
675 | spin_lock(&adapter->mbox_lock); | 679 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
680 | return -1; | ||
676 | 681 | ||
677 | wrb = wrb_from_mbox(adapter); | 682 | wrb = wrb_from_mbox(adapter); |
678 | req = embedded_payload(wrb); | 683 | req = embedded_payload(wrb); |
@@ -726,7 +731,7 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
726 | cq->created = true; | 731 | cq->created = true; |
727 | } | 732 | } |
728 | 733 | ||
729 | spin_unlock(&adapter->mbox_lock); | 734 | mutex_unlock(&adapter->mbox_lock); |
730 | 735 | ||
731 | return status; | 736 | return status; |
732 | } | 737 | } |
@@ -749,7 +754,8 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
749 | void *ctxt; | 754 | void *ctxt; |
750 | int status; | 755 | int status; |
751 | 756 | ||
752 | spin_lock(&adapter->mbox_lock); | 757 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
758 | return -1; | ||
753 | 759 | ||
754 | wrb = wrb_from_mbox(adapter); | 760 | wrb = wrb_from_mbox(adapter); |
755 | req = embedded_payload(wrb); | 761 | req = embedded_payload(wrb); |
@@ -793,7 +799,7 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
793 | mccq->id = le16_to_cpu(resp->id); | 799 | mccq->id = le16_to_cpu(resp->id); |
794 | mccq->created = true; | 800 | mccq->created = true; |
795 | } | 801 | } |
796 | spin_unlock(&adapter->mbox_lock); | 802 | mutex_unlock(&adapter->mbox_lock); |
797 | 803 | ||
798 | return status; | 804 | return status; |
799 | } | 805 | } |
@@ -808,7 +814,8 @@ int be_cmd_txq_create(struct be_adapter *adapter, | |||
808 | void *ctxt; | 814 | void *ctxt; |
809 | int status; | 815 | int status; |
810 | 816 | ||
811 | spin_lock(&adapter->mbox_lock); | 817 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
818 | return -1; | ||
812 | 819 | ||
813 | wrb = wrb_from_mbox(adapter); | 820 | wrb = wrb_from_mbox(adapter); |
814 | req = embedded_payload(wrb); | 821 | req = embedded_payload(wrb); |
@@ -840,7 +847,7 @@ int be_cmd_txq_create(struct be_adapter *adapter, | |||
840 | txq->created = true; | 847 | txq->created = true; |
841 | } | 848 | } |
842 | 849 | ||
843 | spin_unlock(&adapter->mbox_lock); | 850 | mutex_unlock(&adapter->mbox_lock); |
844 | 851 | ||
845 | return status; | 852 | return status; |
846 | } | 853 | } |
@@ -855,7 +862,8 @@ int be_cmd_rxq_create(struct be_adapter *adapter, | |||
855 | struct be_dma_mem *q_mem = &rxq->dma_mem; | 862 | struct be_dma_mem *q_mem = &rxq->dma_mem; |
856 | int status; | 863 | int status; |
857 | 864 | ||
858 | spin_lock(&adapter->mbox_lock); | 865 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
866 | return -1; | ||
859 | 867 | ||
860 | wrb = wrb_from_mbox(adapter); | 868 | wrb = wrb_from_mbox(adapter); |
861 | req = embedded_payload(wrb); | 869 | req = embedded_payload(wrb); |
@@ -882,7 +890,7 @@ int be_cmd_rxq_create(struct be_adapter *adapter, | |||
882 | *rss_id = resp->rss_id; | 890 | *rss_id = resp->rss_id; |
883 | } | 891 | } |
884 | 892 | ||
885 | spin_unlock(&adapter->mbox_lock); | 893 | mutex_unlock(&adapter->mbox_lock); |
886 | 894 | ||
887 | return status; | 895 | return status; |
888 | } | 896 | } |
@@ -901,7 +909,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, | |||
901 | if (adapter->eeh_err) | 909 | if (adapter->eeh_err) |
902 | return -EIO; | 910 | return -EIO; |
903 | 911 | ||
904 | spin_lock(&adapter->mbox_lock); | 912 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
913 | return -1; | ||
905 | 914 | ||
906 | wrb = wrb_from_mbox(adapter); | 915 | wrb = wrb_from_mbox(adapter); |
907 | req = embedded_payload(wrb); | 916 | req = embedded_payload(wrb); |
@@ -938,7 +947,7 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, | |||
938 | 947 | ||
939 | status = be_mbox_notify_wait(adapter); | 948 | status = be_mbox_notify_wait(adapter); |
940 | 949 | ||
941 | spin_unlock(&adapter->mbox_lock); | 950 | mutex_unlock(&adapter->mbox_lock); |
942 | 951 | ||
943 | return status; | 952 | return status; |
944 | } | 953 | } |
@@ -954,7 +963,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, | |||
954 | struct be_cmd_req_if_create *req; | 963 | struct be_cmd_req_if_create *req; |
955 | int status; | 964 | int status; |
956 | 965 | ||
957 | spin_lock(&adapter->mbox_lock); | 966 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
967 | return -1; | ||
958 | 968 | ||
959 | wrb = wrb_from_mbox(adapter); | 969 | wrb = wrb_from_mbox(adapter); |
960 | req = embedded_payload(wrb); | 970 | req = embedded_payload(wrb); |
@@ -980,7 +990,7 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, | |||
980 | *pmac_id = le32_to_cpu(resp->pmac_id); | 990 | *pmac_id = le32_to_cpu(resp->pmac_id); |
981 | } | 991 | } |
982 | 992 | ||
983 | spin_unlock(&adapter->mbox_lock); | 993 | mutex_unlock(&adapter->mbox_lock); |
984 | return status; | 994 | return status; |
985 | } | 995 | } |
986 | 996 | ||
@@ -994,7 +1004,8 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id) | |||
994 | if (adapter->eeh_err) | 1004 | if (adapter->eeh_err) |
995 | return -EIO; | 1005 | return -EIO; |
996 | 1006 | ||
997 | spin_lock(&adapter->mbox_lock); | 1007 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1008 | return -1; | ||
998 | 1009 | ||
999 | wrb = wrb_from_mbox(adapter); | 1010 | wrb = wrb_from_mbox(adapter); |
1000 | req = embedded_payload(wrb); | 1011 | req = embedded_payload(wrb); |
@@ -1009,7 +1020,7 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id) | |||
1009 | 1020 | ||
1010 | status = be_mbox_notify_wait(adapter); | 1021 | status = be_mbox_notify_wait(adapter); |
1011 | 1022 | ||
1012 | spin_unlock(&adapter->mbox_lock); | 1023 | mutex_unlock(&adapter->mbox_lock); |
1013 | 1024 | ||
1014 | return status; | 1025 | return status; |
1015 | } | 1026 | } |
@@ -1099,7 +1110,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver) | |||
1099 | struct be_cmd_req_get_fw_version *req; | 1110 | struct be_cmd_req_get_fw_version *req; |
1100 | int status; | 1111 | int status; |
1101 | 1112 | ||
1102 | spin_lock(&adapter->mbox_lock); | 1113 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1114 | return -1; | ||
1103 | 1115 | ||
1104 | wrb = wrb_from_mbox(adapter); | 1116 | wrb = wrb_from_mbox(adapter); |
1105 | req = embedded_payload(wrb); | 1117 | req = embedded_payload(wrb); |
@@ -1116,7 +1128,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver) | |||
1116 | strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN); | 1128 | strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN); |
1117 | } | 1129 | } |
1118 | 1130 | ||
1119 | spin_unlock(&adapter->mbox_lock); | 1131 | mutex_unlock(&adapter->mbox_lock); |
1120 | return status; | 1132 | return status; |
1121 | } | 1133 | } |
1122 | 1134 | ||
@@ -1361,7 +1373,8 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, | |||
1361 | struct be_cmd_req_query_fw_cfg *req; | 1373 | struct be_cmd_req_query_fw_cfg *req; |
1362 | int status; | 1374 | int status; |
1363 | 1375 | ||
1364 | spin_lock(&adapter->mbox_lock); | 1376 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1377 | return -1; | ||
1365 | 1378 | ||
1366 | wrb = wrb_from_mbox(adapter); | 1379 | wrb = wrb_from_mbox(adapter); |
1367 | req = embedded_payload(wrb); | 1380 | req = embedded_payload(wrb); |
@@ -1380,7 +1393,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, | |||
1380 | *caps = le32_to_cpu(resp->function_caps); | 1393 | *caps = le32_to_cpu(resp->function_caps); |
1381 | } | 1394 | } |
1382 | 1395 | ||
1383 | spin_unlock(&adapter->mbox_lock); | 1396 | mutex_unlock(&adapter->mbox_lock); |
1384 | return status; | 1397 | return status; |
1385 | } | 1398 | } |
1386 | 1399 | ||
@@ -1391,7 +1404,8 @@ int be_cmd_reset_function(struct be_adapter *adapter) | |||
1391 | struct be_cmd_req_hdr *req; | 1404 | struct be_cmd_req_hdr *req; |
1392 | int status; | 1405 | int status; |
1393 | 1406 | ||
1394 | spin_lock(&adapter->mbox_lock); | 1407 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1408 | return -1; | ||
1395 | 1409 | ||
1396 | wrb = wrb_from_mbox(adapter); | 1410 | wrb = wrb_from_mbox(adapter); |
1397 | req = embedded_payload(wrb); | 1411 | req = embedded_payload(wrb); |
@@ -1404,7 +1418,7 @@ int be_cmd_reset_function(struct be_adapter *adapter) | |||
1404 | 1418 | ||
1405 | status = be_mbox_notify_wait(adapter); | 1419 | status = be_mbox_notify_wait(adapter); |
1406 | 1420 | ||
1407 | spin_unlock(&adapter->mbox_lock); | 1421 | mutex_unlock(&adapter->mbox_lock); |
1408 | return status; | 1422 | return status; |
1409 | } | 1423 | } |
1410 | 1424 | ||
@@ -1415,7 +1429,8 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size) | |||
1415 | u32 myhash[10]; | 1429 | u32 myhash[10]; |
1416 | int status; | 1430 | int status; |
1417 | 1431 | ||
1418 | spin_lock(&adapter->mbox_lock); | 1432 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1433 | return -1; | ||
1419 | 1434 | ||
1420 | wrb = wrb_from_mbox(adapter); | 1435 | wrb = wrb_from_mbox(adapter); |
1421 | req = embedded_payload(wrb); | 1436 | req = embedded_payload(wrb); |
@@ -1435,7 +1450,7 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size) | |||
1435 | 1450 | ||
1436 | status = be_mbox_notify_wait(adapter); | 1451 | status = be_mbox_notify_wait(adapter); |
1437 | 1452 | ||
1438 | spin_unlock(&adapter->mbox_lock); | 1453 | mutex_unlock(&adapter->mbox_lock); |
1439 | return status; | 1454 | return status; |
1440 | } | 1455 | } |
1441 | 1456 | ||