@@ -2015,6 +2015,18 @@ static void i40e_get_drvinfo(struct net_device *netdev,
2015
2015
drvinfo -> n_priv_flags += I40E_GL_PRIV_FLAGS_STR_LEN ;
2016
2016
}
2017
2017
2018
+ static u32 i40e_get_max_num_descriptors (struct i40e_pf * pf )
2019
+ {
2020
+ struct i40e_hw * hw = & pf -> hw ;
2021
+
2022
+ switch (hw -> mac .type ) {
2023
+ case I40E_MAC_XL710 :
2024
+ return I40E_MAX_NUM_DESCRIPTORS_XL710 ;
2025
+ default :
2026
+ return I40E_MAX_NUM_DESCRIPTORS ;
2027
+ }
2028
+ }
2029
+
2018
2030
static void i40e_get_ringparam (struct net_device * netdev ,
2019
2031
struct ethtool_ringparam * ring ,
2020
2032
struct kernel_ethtool_ringparam * kernel_ring ,
@@ -2024,8 +2036,8 @@ static void i40e_get_ringparam(struct net_device *netdev,
2024
2036
struct i40e_pf * pf = np -> vsi -> back ;
2025
2037
struct i40e_vsi * vsi = pf -> vsi [pf -> lan_vsi ];
2026
2038
2027
- ring -> rx_max_pending = I40E_MAX_NUM_DESCRIPTORS ;
2028
- ring -> tx_max_pending = I40E_MAX_NUM_DESCRIPTORS ;
2039
+ ring -> rx_max_pending = i40e_get_max_num_descriptors ( pf ) ;
2040
+ ring -> tx_max_pending = i40e_get_max_num_descriptors ( pf ) ;
2029
2041
ring -> rx_mini_max_pending = 0 ;
2030
2042
ring -> rx_jumbo_max_pending = 0 ;
2031
2043
ring -> rx_pending = vsi -> rx_rings [0 ]-> count ;
@@ -2050,27 +2062,28 @@ static int i40e_set_ringparam(struct net_device *netdev,
2050
2062
struct kernel_ethtool_ringparam * kernel_ring ,
2051
2063
struct netlink_ext_ack * extack )
2052
2064
{
2065
+ u32 new_rx_count , new_tx_count , max_num_descriptors ;
2053
2066
struct i40e_ring * tx_rings = NULL , * rx_rings = NULL ;
2054
2067
struct i40e_netdev_priv * np = netdev_priv (netdev );
2055
2068
struct i40e_hw * hw = & np -> vsi -> back -> hw ;
2056
2069
struct i40e_vsi * vsi = np -> vsi ;
2057
2070
struct i40e_pf * pf = vsi -> back ;
2058
- u32 new_rx_count , new_tx_count ;
2059
2071
u16 tx_alloc_queue_pairs ;
2060
2072
int timeout = 50 ;
2061
2073
int i , err = 0 ;
2062
2074
2063
2075
if ((ring -> rx_mini_pending ) || (ring -> rx_jumbo_pending ))
2064
2076
return - EINVAL ;
2065
2077
2066
- if (ring -> tx_pending > I40E_MAX_NUM_DESCRIPTORS ||
2078
+ max_num_descriptors = i40e_get_max_num_descriptors (pf );
2079
+ if (ring -> tx_pending > max_num_descriptors ||
2067
2080
ring -> tx_pending < I40E_MIN_NUM_DESCRIPTORS ||
2068
- ring -> rx_pending > I40E_MAX_NUM_DESCRIPTORS ||
2081
+ ring -> rx_pending > max_num_descriptors ||
2069
2082
ring -> rx_pending < I40E_MIN_NUM_DESCRIPTORS ) {
2070
2083
netdev_info (netdev ,
2071
2084
"Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n" ,
2072
2085
ring -> tx_pending , ring -> rx_pending ,
2073
- I40E_MIN_NUM_DESCRIPTORS , I40E_MAX_NUM_DESCRIPTORS );
2086
+ I40E_MIN_NUM_DESCRIPTORS , max_num_descriptors );
2074
2087
return - EINVAL ;
2075
2088
}
2076
2089
0 commit comments