1
1
// SPDX-License-Identifier: GPL-2.0
2
- /* Copyright (c) 2018, Intel Corporation. */
2
+ /* Copyright (c) 2018-2023 , Intel Corporation. */
3
3
4
4
#include "ice_common.h"
5
5
#include "ice_sched.h"
@@ -154,6 +154,12 @@ static int ice_set_mac_type(struct ice_hw *hw)
154
154
case ICE_DEV_ID_E823L_SFP :
155
155
hw -> mac_type = ICE_MAC_GENERIC ;
156
156
break ;
157
+ case ICE_DEV_ID_E830_BACKPLANE :
158
+ case ICE_DEV_ID_E830_QSFP56 :
159
+ case ICE_DEV_ID_E830_SFP :
160
+ case ICE_DEV_ID_E830_SFP_DD :
161
+ hw -> mac_type = ICE_MAC_E830 ;
162
+ break ;
157
163
default :
158
164
hw -> mac_type = ICE_MAC_UNKNOWN ;
159
165
break ;
@@ -645,6 +651,24 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi)
645
651
return ICE_MEDIA_UNKNOWN ;
646
652
}
647
653
654
+ /**
655
+ * ice_get_link_status_datalen
656
+ * @hw: pointer to the HW struct
657
+ *
658
+ * Returns datalength for the Get Link Status AQ command, which is bigger for
659
+ * newer adapter families handled by ice driver.
660
+ */
661
+ static u16 ice_get_link_status_datalen (struct ice_hw * hw )
662
+ {
663
+ switch (hw -> mac_type ) {
664
+ case ICE_MAC_E830 :
665
+ return ICE_AQC_LS_DATA_SIZE_V2 ;
666
+ case ICE_MAC_E810 :
667
+ default :
668
+ return ICE_AQC_LS_DATA_SIZE_V1 ;
669
+ }
670
+ }
671
+
648
672
/**
649
673
* ice_aq_get_link_info
650
674
* @pi: port information structure
@@ -683,8 +707,8 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
683
707
resp -> cmd_flags = cpu_to_le16 (cmd_flags );
684
708
resp -> lport_num = pi -> lport ;
685
709
686
- status = ice_aq_send_cmd (hw , & desc , & link_data , sizeof ( link_data ), cd );
687
-
710
+ status = ice_aq_send_cmd (hw , & desc , & link_data ,
711
+ ice_get_link_status_datalen ( hw ), cd );
688
712
if (status )
689
713
return status ;
690
714
@@ -759,8 +783,7 @@ static void
759
783
ice_fill_tx_timer_and_fc_thresh (struct ice_hw * hw ,
760
784
struct ice_aqc_set_mac_cfg * cmd )
761
785
{
762
- u16 fc_thres_val , tx_timer_val ;
763
- u32 val ;
786
+ u32 val , fc_thres_m ;
764
787
765
788
/* We read back the transmit timer and FC threshold value of
766
789
* LFC. Thus, we will use index =
@@ -769,19 +792,32 @@ ice_fill_tx_timer_and_fc_thresh(struct ice_hw *hw,
769
792
* Also, because we are operating on transmit timer and FC
770
793
* threshold of LFC, we don't turn on any bit in tx_tmr_priority
771
794
*/
772
- #define IDX_OF_LFC PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_MAX_INDEX
773
-
774
- /* Retrieve the transmit timer */
775
- val = rd32 (hw , PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA (IDX_OF_LFC ));
776
- tx_timer_val = val &
777
- PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_HSEC_CTL_TX_PAUSE_QUANTA_M ;
778
- cmd -> tx_tmr_value = cpu_to_le16 (tx_timer_val );
779
-
780
- /* Retrieve the FC threshold */
781
- val = rd32 (hw , PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER (IDX_OF_LFC ));
782
- fc_thres_val = val & PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER_M ;
783
-
784
- cmd -> fc_refresh_threshold = cpu_to_le16 (fc_thres_val );
795
+ #define E800_IDX_OF_LFC E800_PRTMAC_HSEC_CTL_TX_PS_QNT_MAX
796
+ #define E800_REFRESH_TMR E800_PRTMAC_HSEC_CTL_TX_PS_RFSH_TMR
797
+
798
+ if (hw -> mac_type == ICE_MAC_E830 ) {
799
+ /* Retrieve the transmit timer */
800
+ val = rd32 (hw , E830_PRTMAC_CL01_PS_QNT );
801
+ cmd -> tx_tmr_value =
802
+ le16_encode_bits (val , E830_PRTMAC_CL01_PS_QNT_CL0_M );
803
+
804
+ /* Retrieve the fc threshold */
805
+ val = rd32 (hw , E830_PRTMAC_CL01_QNT_THR );
806
+ fc_thres_m = E830_PRTMAC_CL01_QNT_THR_CL0_M ;
807
+ } else {
808
+ /* Retrieve the transmit timer */
809
+ val = rd32 (hw ,
810
+ E800_PRTMAC_HSEC_CTL_TX_PS_QNT (E800_IDX_OF_LFC ));
811
+ cmd -> tx_tmr_value =
812
+ le16_encode_bits (val ,
813
+ E800_PRTMAC_HSEC_CTL_TX_PS_QNT_M );
814
+
815
+ /* Retrieve the fc threshold */
816
+ val = rd32 (hw ,
817
+ E800_REFRESH_TMR (E800_IDX_OF_LFC ));
818
+ fc_thres_m = E800_PRTMAC_HSEC_CTL_TX_PS_RFSH_TMR_M ;
819
+ }
820
+ cmd -> fc_refresh_threshold = le16_encode_bits (val , fc_thres_m );
785
821
}
786
822
787
823
/**
@@ -2464,16 +2500,21 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
2464
2500
static void
2465
2501
ice_parse_fdir_func_caps (struct ice_hw * hw , struct ice_hw_func_caps * func_p )
2466
2502
{
2467
- u32 reg_val , val ;
2503
+ u32 reg_val , gsize , bsize ;
2468
2504
2469
2505
reg_val = rd32 (hw , GLQF_FD_SIZE );
2470
- val = (reg_val & GLQF_FD_SIZE_FD_GSIZE_M ) >>
2471
- GLQF_FD_SIZE_FD_GSIZE_S ;
2472
- func_p -> fd_fltr_guar =
2473
- ice_get_num_per_func (hw , val );
2474
- val = (reg_val & GLQF_FD_SIZE_FD_BSIZE_M ) >>
2475
- GLQF_FD_SIZE_FD_BSIZE_S ;
2476
- func_p -> fd_fltr_best_effort = val ;
2506
+ switch (hw -> mac_type ) {
2507
+ case ICE_MAC_E830 :
2508
+ gsize = FIELD_GET (E830_GLQF_FD_SIZE_FD_GSIZE_M , reg_val );
2509
+ bsize = FIELD_GET (E830_GLQF_FD_SIZE_FD_BSIZE_M , reg_val );
2510
+ break ;
2511
+ case ICE_MAC_E810 :
2512
+ default :
2513
+ gsize = FIELD_GET (E800_GLQF_FD_SIZE_FD_GSIZE_M , reg_val );
2514
+ bsize = FIELD_GET (E800_GLQF_FD_SIZE_FD_BSIZE_M , reg_val );
2515
+ }
2516
+ func_p -> fd_fltr_guar = ice_get_num_per_func (hw , gsize );
2517
+ func_p -> fd_fltr_best_effort = bsize ;
2477
2518
2478
2519
ice_debug (hw , ICE_DBG_INIT , "func caps: fd_fltr_guar = %d\n" ,
2479
2520
func_p -> fd_fltr_guar );
@@ -6069,6 +6110,7 @@ static const u32 ice_aq_to_link_speed[] = {
6069
6110
SPEED_40000 ,
6070
6111
SPEED_50000 ,
6071
6112
SPEED_100000 , /* BIT(10) */
6113
+ SPEED_200000 ,
6072
6114
};
6073
6115
6074
6116
/**
0 commit comments