diff options
author | Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> | 2018-09-19 20:42:54 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-10-03 10:42:29 -0400 |
commit | 75d2b253026b8b1cb625f6ccdb9d54cdecae7935 (patch) | |
tree | 6b38e02f7cffe61b3d66a2c4e2aab7076747fd10 /drivers/net/ethernet/intel/ice/ice_controlq.c | |
parent | 16fc087b9cb22c9a97307cc24a5413d0df68fe11 (diff) |
ice: Add support to detect SR-IOV capability and mailbox queues
Mailbox queue is a type of control queue that's used for communication
between PF and VF. This patch adds code to initialize, configure and
use mailbox queues.
This patch also adds support to detect and parse SR-IOV capabilities
returned by the hardware.
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_controlq.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_controlq.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c index b25ce4f587f5..84c967294eaf 100644 --- a/drivers/net/ethernet/intel/ice/ice_controlq.c +++ b/drivers/net/ethernet/intel/ice/ice_controlq.c | |||
@@ -33,6 +33,36 @@ static void ice_adminq_init_regs(struct ice_hw *hw) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * ice_mailbox_init_regs - Initialize Mailbox registers | ||
37 | * @hw: pointer to the hardware structure | ||
38 | * | ||
39 | * This assumes the alloc_sq and alloc_rq functions have already been called | ||
40 | */ | ||
41 | static void ice_mailbox_init_regs(struct ice_hw *hw) | ||
42 | { | ||
43 | struct ice_ctl_q_info *cq = &hw->mailboxq; | ||
44 | |||
45 | /* set head and tail registers in our local struct */ | ||
46 | cq->sq.head = PF_MBX_ATQH; | ||
47 | cq->sq.tail = PF_MBX_ATQT; | ||
48 | cq->sq.len = PF_MBX_ATQLEN; | ||
49 | cq->sq.bah = PF_MBX_ATQBAH; | ||
50 | cq->sq.bal = PF_MBX_ATQBAL; | ||
51 | cq->sq.len_mask = PF_MBX_ATQLEN_ATQLEN_M; | ||
52 | cq->sq.len_ena_mask = PF_MBX_ATQLEN_ATQENABLE_M; | ||
53 | cq->sq.head_mask = PF_MBX_ATQH_ATQH_M; | ||
54 | |||
55 | cq->rq.head = PF_MBX_ARQH; | ||
56 | cq->rq.tail = PF_MBX_ARQT; | ||
57 | cq->rq.len = PF_MBX_ARQLEN; | ||
58 | cq->rq.bah = PF_MBX_ARQBAH; | ||
59 | cq->rq.bal = PF_MBX_ARQBAL; | ||
60 | cq->rq.len_mask = PF_MBX_ARQLEN_ARQLEN_M; | ||
61 | cq->rq.len_ena_mask = PF_MBX_ARQLEN_ARQENABLE_M; | ||
62 | cq->rq.head_mask = PF_MBX_ARQH_ARQH_M; | ||
63 | } | ||
64 | |||
65 | /** | ||
36 | * ice_check_sq_alive | 66 | * ice_check_sq_alive |
37 | * @hw: pointer to the hw struct | 67 | * @hw: pointer to the hw struct |
38 | * @cq: pointer to the specific Control queue | 68 | * @cq: pointer to the specific Control queue |
@@ -639,6 +669,10 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type) | |||
639 | ice_adminq_init_regs(hw); | 669 | ice_adminq_init_regs(hw); |
640 | cq = &hw->adminq; | 670 | cq = &hw->adminq; |
641 | break; | 671 | break; |
672 | case ICE_CTL_Q_MAILBOX: | ||
673 | ice_mailbox_init_regs(hw); | ||
674 | cq = &hw->mailboxq; | ||
675 | break; | ||
642 | default: | 676 | default: |
643 | return ICE_ERR_PARAM; | 677 | return ICE_ERR_PARAM; |
644 | } | 678 | } |
@@ -696,7 +730,12 @@ enum ice_status ice_init_all_ctrlq(struct ice_hw *hw) | |||
696 | if (ret_code) | 730 | if (ret_code) |
697 | return ret_code; | 731 | return ret_code; |
698 | 732 | ||
699 | return ice_init_check_adminq(hw); | 733 | ret_code = ice_init_check_adminq(hw); |
734 | if (ret_code) | ||
735 | return ret_code; | ||
736 | |||
737 | /* Init Mailbox queue */ | ||
738 | return ice_init_ctrlq(hw, ICE_CTL_Q_MAILBOX); | ||
700 | } | 739 | } |
701 | 740 | ||
702 | /** | 741 | /** |
@@ -714,6 +753,9 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type) | |||
714 | if (ice_check_sq_alive(hw, cq)) | 753 | if (ice_check_sq_alive(hw, cq)) |
715 | ice_aq_q_shutdown(hw, true); | 754 | ice_aq_q_shutdown(hw, true); |
716 | break; | 755 | break; |
756 | case ICE_CTL_Q_MAILBOX: | ||
757 | cq = &hw->mailboxq; | ||
758 | break; | ||
717 | default: | 759 | default: |
718 | return; | 760 | return; |
719 | } | 761 | } |
@@ -736,6 +778,8 @@ void ice_shutdown_all_ctrlq(struct ice_hw *hw) | |||
736 | { | 778 | { |
737 | /* Shutdown FW admin queue */ | 779 | /* Shutdown FW admin queue */ |
738 | ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN); | 780 | ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN); |
781 | /* Shutdown PF-VF Mailbox */ | ||
782 | ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX); | ||
739 | } | 783 | } |
740 | 784 | ||
741 | /** | 785 | /** |