i40e_adminq.c (416ba5c74546f32a993436a99516d35008e9f384) | i40e_adminq.c (ac83ea833d494a651c3fa807c90675b724a78c19) |
---|---|
1/****************************************************************************** 2 3 Copyright (c) 2013-2015, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 482 unchanged lines hidden (view full) --- 491 * @hw: pointer to the hardware structure 492 * 493 * The main shutdown routine for the Admin Send Queue 494 **/ 495enum i40e_status_code i40e_shutdown_asq(struct i40e_hw *hw) 496{ 497 enum i40e_status_code ret_code = I40E_SUCCESS; 498 | 1/****************************************************************************** 2 3 Copyright (c) 2013-2015, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 482 unchanged lines hidden (view full) --- 491 * @hw: pointer to the hardware structure 492 * 493 * The main shutdown routine for the Admin Send Queue 494 **/ 495enum i40e_status_code i40e_shutdown_asq(struct i40e_hw *hw) 496{ 497 enum i40e_status_code ret_code = I40E_SUCCESS; 498 |
499 if (hw->aq.asq.count == 0) 500 return I40E_ERR_NOT_READY; | 499 i40e_acquire_spinlock(&hw->aq.asq_spinlock); |
501 | 500 |
501 if (hw->aq.asq.count == 0) { 502 ret_code = I40E_ERR_NOT_READY; 503 goto shutdown_asq_out; 504 } 505 |
|
502 /* Stop firmware AdminQ processing */ 503 wr32(hw, hw->aq.asq.head, 0); 504 wr32(hw, hw->aq.asq.tail, 0); 505 wr32(hw, hw->aq.asq.len, 0); 506 wr32(hw, hw->aq.asq.bal, 0); 507 wr32(hw, hw->aq.asq.bah, 0); 508 | 506 /* Stop firmware AdminQ processing */ 507 wr32(hw, hw->aq.asq.head, 0); 508 wr32(hw, hw->aq.asq.tail, 0); 509 wr32(hw, hw->aq.asq.len, 0); 510 wr32(hw, hw->aq.asq.bal, 0); 511 wr32(hw, hw->aq.asq.bah, 0); 512 |
509 /* make sure spinlock is available */ 510 i40e_acquire_spinlock(&hw->aq.asq_spinlock); 511 | |
512 hw->aq.asq.count = 0; /* to indicate uninitialized queue */ 513 514 /* free ring buffers */ 515 i40e_free_asq_bufs(hw); 516 | 513 hw->aq.asq.count = 0; /* to indicate uninitialized queue */ 514 515 /* free ring buffers */ 516 i40e_free_asq_bufs(hw); 517 |
518shutdown_asq_out: |
|
517 i40e_release_spinlock(&hw->aq.asq_spinlock); | 519 i40e_release_spinlock(&hw->aq.asq_spinlock); |
518 | |
519 return ret_code; 520} 521 522/** 523 * i40e_shutdown_arq - shutdown ARQ 524 * @hw: pointer to the hardware structure 525 * 526 * The main shutdown routine for the Admin Receive Queue 527 **/ 528enum i40e_status_code i40e_shutdown_arq(struct i40e_hw *hw) 529{ 530 enum i40e_status_code ret_code = I40E_SUCCESS; 531 | 520 return ret_code; 521} 522 523/** 524 * i40e_shutdown_arq - shutdown ARQ 525 * @hw: pointer to the hardware structure 526 * 527 * The main shutdown routine for the Admin Receive Queue 528 **/ 529enum i40e_status_code i40e_shutdown_arq(struct i40e_hw *hw) 530{ 531 enum i40e_status_code ret_code = I40E_SUCCESS; 532 |
532 if (hw->aq.arq.count == 0) 533 return I40E_ERR_NOT_READY; | 533 i40e_acquire_spinlock(&hw->aq.arq_spinlock); |
534 | 534 |
535 if (hw->aq.arq.count == 0) { 536 ret_code = I40E_ERR_NOT_READY; 537 goto shutdown_arq_out; 538 } 539 |
|
535 /* Stop firmware AdminQ processing */ 536 wr32(hw, hw->aq.arq.head, 0); 537 wr32(hw, hw->aq.arq.tail, 0); 538 wr32(hw, hw->aq.arq.len, 0); 539 wr32(hw, hw->aq.arq.bal, 0); 540 wr32(hw, hw->aq.arq.bah, 0); 541 | 540 /* Stop firmware AdminQ processing */ 541 wr32(hw, hw->aq.arq.head, 0); 542 wr32(hw, hw->aq.arq.tail, 0); 543 wr32(hw, hw->aq.arq.len, 0); 544 wr32(hw, hw->aq.arq.bal, 0); 545 wr32(hw, hw->aq.arq.bah, 0); 546 |
542 /* make sure spinlock is available */ 543 i40e_acquire_spinlock(&hw->aq.arq_spinlock); 544 | |
545 hw->aq.arq.count = 0; /* to indicate uninitialized queue */ 546 547 /* free ring buffers */ 548 i40e_free_arq_bufs(hw); 549 | 547 hw->aq.arq.count = 0; /* to indicate uninitialized queue */ 548 549 /* free ring buffers */ 550 i40e_free_arq_bufs(hw); 551 |
552shutdown_arq_out: |
|
550 i40e_release_spinlock(&hw->aq.arq_spinlock); | 553 i40e_release_spinlock(&hw->aq.arq_spinlock); |
551 | |
552 return ret_code; 553} 554 555/** 556 * i40e_init_adminq - main initialization routine for Admin Queue 557 * @hw: pointer to the hardware structure 558 * 559 * Prior to calling this function, drivers *MUST* set the following fields --- 208 unchanged lines hidden (view full) --- 768 enum i40e_status_code status = I40E_SUCCESS; 769 struct i40e_dma_mem *dma_buff = NULL; 770 struct i40e_asq_cmd_details *details; 771 struct i40e_aq_desc *desc_on_ring; 772 bool cmd_completed = FALSE; 773 u16 retval = 0; 774 u32 val = 0; 775 | 554 return ret_code; 555} 556 557/** 558 * i40e_init_adminq - main initialization routine for Admin Queue 559 * @hw: pointer to the hardware structure 560 * 561 * Prior to calling this function, drivers *MUST* set the following fields --- 208 unchanged lines hidden (view full) --- 770 enum i40e_status_code status = I40E_SUCCESS; 771 struct i40e_dma_mem *dma_buff = NULL; 772 struct i40e_asq_cmd_details *details; 773 struct i40e_aq_desc *desc_on_ring; 774 bool cmd_completed = FALSE; 775 u16 retval = 0; 776 u32 val = 0; 777 |
778 i40e_acquire_spinlock(&hw->aq.asq_spinlock); 779 |
|
776 hw->aq.asq_last_status = I40E_AQ_RC_OK; 777 | 780 hw->aq.asq_last_status = I40E_AQ_RC_OK; 781 |
778 val = rd32(hw, hw->aq.asq.head); 779 if (val >= hw->aq.num_asq_entries) { | 782 if (hw->aq.asq.count == 0) { |
780 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, | 783 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, |
781 "AQTX: head overrun at %d\n", val); | 784 "AQTX: Admin queue not initialized.\n"); |
782 status = I40E_ERR_QUEUE_EMPTY; | 785 status = I40E_ERR_QUEUE_EMPTY; |
783 goto asq_send_command_exit; | 786 goto asq_send_command_error; |
784 } 785 | 787 } 788 |
786 if (hw->aq.asq.count == 0) { | 789 val = rd32(hw, hw->aq.asq.head); 790 if (val >= hw->aq.num_asq_entries) { |
787 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, | 791 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, |
788 "AQTX: Admin queue not initialized.\n"); | 792 "AQTX: head overrun at %d\n", val); |
789 status = I40E_ERR_QUEUE_EMPTY; | 793 status = I40E_ERR_QUEUE_EMPTY; |
790 goto asq_send_command_exit; | 794 goto asq_send_command_error; |
791 } 792 793 details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); 794 if (cmd_details) { 795 i40e_memcpy(details, 796 cmd_details, 797 sizeof(struct i40e_asq_cmd_details), 798 I40E_NONDMA_TO_NONDMA); --- 13 unchanged lines hidden (view full) --- 812 sizeof(struct i40e_asq_cmd_details), 813 I40E_NONDMA_MEM); 814 } 815 816 /* clear requested flags and then set additional flags if defined */ 817 desc->flags &= ~CPU_TO_LE16(details->flags_dis); 818 desc->flags |= CPU_TO_LE16(details->flags_ena); 819 | 795 } 796 797 details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); 798 if (cmd_details) { 799 i40e_memcpy(details, 800 cmd_details, 801 sizeof(struct i40e_asq_cmd_details), 802 I40E_NONDMA_TO_NONDMA); --- 13 unchanged lines hidden (view full) --- 816 sizeof(struct i40e_asq_cmd_details), 817 I40E_NONDMA_MEM); 818 } 819 820 /* clear requested flags and then set additional flags if defined */ 821 desc->flags &= ~CPU_TO_LE16(details->flags_dis); 822 desc->flags |= CPU_TO_LE16(details->flags_ena); 823 |
820 i40e_acquire_spinlock(&hw->aq.asq_spinlock); 821 | |
822 if (buff_size > hw->aq.asq_buf_size) { 823 i40e_debug(hw, 824 I40E_DEBUG_AQ_MESSAGE, 825 "AQTX: Invalid buffer size: %d.\n", 826 buff_size); 827 status = I40E_ERR_INVALID_SIZE; 828 goto asq_send_command_error; 829 } --- 113 unchanged lines hidden (view full) --- 943 i40e_debug(hw, 944 I40E_DEBUG_AQ_MESSAGE, 945 "AQTX: Writeback timeout.\n"); 946 status = I40E_ERR_ADMIN_QUEUE_TIMEOUT; 947 } 948 949asq_send_command_error: 950 i40e_release_spinlock(&hw->aq.asq_spinlock); | 824 if (buff_size > hw->aq.asq_buf_size) { 825 i40e_debug(hw, 826 I40E_DEBUG_AQ_MESSAGE, 827 "AQTX: Invalid buffer size: %d.\n", 828 buff_size); 829 status = I40E_ERR_INVALID_SIZE; 830 goto asq_send_command_error; 831 } --- 113 unchanged lines hidden (view full) --- 945 i40e_debug(hw, 946 I40E_DEBUG_AQ_MESSAGE, 947 "AQTX: Writeback timeout.\n"); 948 status = I40E_ERR_ADMIN_QUEUE_TIMEOUT; 949 } 950 951asq_send_command_error: 952 i40e_release_spinlock(&hw->aq.asq_spinlock); |
951asq_send_command_exit: | |
952 return status; 953} 954 955/** 956 * i40e_fill_default_direct_cmd_desc - AQ descriptor helper function 957 * @desc: pointer to the temp descriptor (non DMA mem) 958 * @opcode: the opcode can be used to decide which flags to turn off or on 959 * --- 142 unchanged lines hidden --- | 953 return status; 954} 955 956/** 957 * i40e_fill_default_direct_cmd_desc - AQ descriptor helper function 958 * @desc: pointer to the temp descriptor (non DMA mem) 959 * @opcode: the opcode can be used to decide which flags to turn off or on 960 * --- 142 unchanged lines hidden --- |