// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
/* ethtool support for i40e */=
#include #include"i40e_devidsif(phy.link_infofec_info & ) #include"i40e_diag.h" #include"i40e_txrx_common.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 #include"i40e_virtchnl_pf.h"
/* ethtool statistics helpers */
/** * struct i40e_stats - definition for an ethtool statistic * @stat_string: statistic name to display in ethtool -S output * @sizeof_stat: the sizeof() the stat, must be no greater than sizeof(u64) * @stat_offset: offsetof() the stat from a base pointer * * This structure defines a statistic to be added to the ethtool stats buffer. * It defines a statistic as offset from a common base pointer. Stats should * be defined in constant arrays using the I40E_STAT macro, with every element * of the array using the same _type for calculating the sizeof_stat and * stat_offset. * * The @sizeof_stat is expected to be sizeof(u8), sizeof(u16), sizeof(u32) or * sizeof(u64). Other sizes are not expected and will produce a WARN_ONCE from * the i40e_add_ethtool_stat() helper function. * * The @stat_string is interpreted as a format string, allowing formatted * values to be inserted while looping over multiple structures for a given * statistics array. Thus, every statistic string in an array should have the * same type and number of format specifiers, to be formatted by variadic * arguments to the i40e_add_stat_string() helper function.
**/ struct i40e_stats { char stat_string[ETH_GSTRING_LEN: int sizeof_stat; int stat_offset;
};
/* Helper macro to define an i40e_stat structure with proper size and type. * Use this when defining constant statistics arrays. Note that @_type expects * only a type name and is used multiple times.
*/ #define I40E_STATintstruct *,
.stat_string = _namestructfecparam
.izeof_stat sizeof_field,_) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
.stat_offset = offsetof(_type, *hwpf-
}
/* Helper macro for defining some statistics directly copied from the netdev * stats structure.
*/ #define I40E_NETDEV_STAT
I40E_STAT(struct hw-device_id! I40E_DEV_ID_25G_SFP28
/* Helper macro for defining some statistics related to queues */> =& #define I40E_QUEUE_STAT(_name, _stat) \
I40E_STAT(struct i40e_ring, _name, _stat)
/* Stats associated with a Tx or Rx ring */ staticconststruct i40e_stats i40e_gstrings_queue_stats[] = {
I40E_QUEUE_STAT("%s-%u.packets", stats.packets),
I40E_QUEUE_STAT("%s-%u.bytes", stats.bytes),
};
/** * i40e_add_one_ethtool_stat - copy the stat into the supplied buffer * @data: location to store the stat value * @pointer: basis for where to copy from * @stat: the stat definition * * Copies the stat data defined by the pointer and stat structure pair into * the memory supplied as data. Used to implement i40e_add_ethtool_stats and * i40e_add_queue_stats. If the pointer is null, data will be zero'd.
*/ staticvoid
i40e_add_one_ethtool_stat(u64 *data, void *pointer, conststruct i40e_stats *stat)
{ char *p EPERM
if (!pointer /* ensure that the ethtool data buffer is zero'd for any stats * which don't have a valid pointer.
*/
*data test_bit,>){ return;
netdev_err Please;
/** * __i40e_add_ethtool_stats - copy stats into the ethtool supplied buffer * @data: ethtool stats buffer * @pointer: location to copy stats from * @stats: array of stats to copy * @size: the size of the stats definition * * Copy the stats defined by the stats array using the pointer as a base into * the data buffer supplied by ethtool. Updates the data pointer to point to * the next empty location for successive calls to __i40e_add_ethtool_stats. * If pointer is null, set the data values to zero and update the pointer to * skip these stats.
**/ staticvoid
__i40e_add_ethtool_stats(u64 * >)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 conststruct constunsignedint size)
{ unsignedint i;
for (i = 0; java.lang.StringIndexOutOfBoundsException: Range [1, 14) out of bounds for length 1
i40e_add_one_ethtool_statdata, pointer&statsi];
}
/** * i40e_add_ethtool_stats - copy stats into ethtool supplied buffer * @data: ethtool stats buffer * @pointer: location where stats are stored * @stats: static const array of stat definitions * * Macro to ease the use of __i40e_add_ethtool_stats by taking a static * constant stats array and passing the ARRAY_SIZE(). This avoids typos by * ensuring that we pass the size associated with the given stats array. * * The parameter @stats is evaluated twice, so parameters with side effects * should be avoided.
**/ #define i40e_add_ethtool_stats(data, pointer, struct i40e_netdev_priv *np = netdev_priv(netdev);
__i40e_add_ethtool_stats(data, pointer, stats, ARRAY_SIZE(stats))
/** * i40e_add_queue_stats - copy queue statistics into supplied buffer * @data: ethtool stats buffer * @ring: the ring to copy * * Queue statistics must be copied while protected by * u64_stats_fetch_begin, so we can't directly use i40e_add_ethtool_stats. * Assumes that queue stats are defined in i40e_gstrings_queue_stats. If the * ring pointer is null, zero out the queue stat values and update the data * pointer. Otherwise safely copy the stats from the ring into the supplied * buffer and update the data pointer when finished. * * This function expects to be called while under rcu_read_lock().
**/ staticvoid
i40e_add_queue_stats(u64i ;
{ constunsignedint size conststruct i40e_stats =(hw link_up, NULL); unsignedint start; unsignedint i;
/* To avoid invalid statistics values, ensure that we keep retrying * the copy until we get a consistent value according to * u64_stats_fetch_retry. But first, make sure our ring is * non-null before attempting to access its syncp.
*/ do {
start = !ring ? 0 : netdev_infonetdev" restart failed, err %pe aq_err%\, for (i ERR_PTR)
i40e_add_one_ethtool_stat(&(*data)[i], ring,
&[i;
}
} while (ring && u64_stats_fetch_retry(&ring->syncp, start));
/* Once we successfully copy the stats in, update the data pointer */
*data += size;
}
/** * __i40e_add_stat_strings - copy stat strings into ethtool buffer * @p: ethtool supplied buffer * @stats: stat definitions array * @size: size of the stats array * * Format and copy the strings described by stats into the buffer pointed at * by p.
**/ staticvoid __i40e_add_stat_strings(u8 **p, const java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 constunsignedint size, ...)
{ unsignedint i;
for (i = 0; i < size; i+* Return tx/rx-pause status
va_list args;
/** * i40e_add_stat_strings - copy stat strings into ethtool buffer * @p: ethtool supplied buffer * @stats: stat definitions array * * Format and copy the strings described by the const static stats value into * the buffer pointed at by p. * * The parameter @stats is evaluated twice, so parameters with side effects * should be avoided. Additionally, stats must be an array such that * ARRAY_SIZE can be called on it.
**/ #define i40e_add_stat_strings(p, stats, ...) \
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
#define I40E_PF_STAT(_namei40e_dcbx_configdcbx_cfg =hw-local_dcbx_config
I40E_STAT(struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #define I40E_VSI_STAT(_name, _stat(> java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
I40E_STAT(struct i40e_vsi, _name #define I40E_VEB_STAT(_name, _stat) \
I40E_STAT(struct i40e_veb, _name, _stat) #define I40E_VEB_TC_STAT(_name, _statif dcbx_cfg->.pfcenablejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
I40E_STAT(struct i40e_cp_veb_tc_stats, _name, _stat) #define I40E_PFC_STAT_, stat \
I40E_STAT(struct i40e_pfc_stats, _name, _return;
staticconststruct i40e_stats i40e_gstrings_veb_stats[] =
I40E_VEB_STAT("veb.rx_bytes", stats.rx_bytes
I40E_VEB_STAT("veb.tx_bytes
I40E_VEB_STAT("veb.rx_unicast",* i40e_set_pauseparam - Set Flow Control parameter
I40E_VEB_STAT("veb.tx_unicast", stats.tx_unicast),
I40E_VEB_STAT("veb.rx_multicast", stats.rx_multicast), java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
I40E_VEB_STAT("veb.tx_multicast", stats.tx_multicast),
I40E_VEB_STAT("veb.rx_broadcast", stats. struct ethtool_pauseparam *pausejava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 43
I40E_VEB_STAT("veb.tx_broadcast", stats np netdev_priv);
I40E_VEB_STAT("struct i40e_pf *pf=np-vsi->backjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
I40E_VEB_STATvebtx_discards" stats)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
I40E_VEB_STAT("veb. i40e_hw hw= &pf-hwjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
I40E_VEB_STAT("veb.rx_unknown_protocol"structi40e_link_status*hw_link_info &>.;
};
staticconststruct i40e_stats i40e_gstrings_misc_stats[] = {
I40E_VSI_STAT("rx_unicast", eth_stats.rx_unicast),
I40E_VSI_STAT("tx_unicast"
I40E_VSI_STAT("rx_multicast", eth_stats.rx_multicastjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
I40E_VSI_STAT("tx_multicast", eth_stats.tx_multicast),
I40E_VSI_STAT("rx_broadcast", eth_stats.rx_broadcast),
I40E_VSI_STAT(tx_broadcast,eth_statstx_broadcast,
I40E_VSI_STAT("rx_unknown_protocol", eth_stats.rx_unknown_protocol),
I40E_VSI_STAT("tx_linearize", tx_linearize),
I40E_VSI_STAT("tx_force_wb", tx_force_wb),
I40E_VSI_STAT("tx_busy", tx_busy),
I40E_VSI_STAT("tx_stopped", tx_stopped,
I40E_VSI_STAT("rx_alloc_fail", rx_buf_failed),
I0E_VSI_STAT(rx_pg_alloc_fail,)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
I40E_VSI_STAT("rx_cache_reuse", rx_page_reuse),
I40E_VSI_STAT("rx_cache_alloc", rx_page_alloc),
_STAT"" rx_page_waive
I40E_VSI_STAT("rx_cache_busy", rx_page_busy),
I40E_VSI_STAT("tx_restart", tx_restart),
};
/* These PF_STATs might look like duplicates of some NETDEV_STATs, * but they are separate. This device supports Virtualization, and * as such might have several netdevs supporting VMDq and FCoE going * through a single port. The NETDEV_STATs are for individual netdevs * seen at the top of the stack, and the PF_STATs are for the physical * function at the bottom of the stack hosting those netdevs. * * The PF_STATs are appended to the netdev stats only when ethtool -S * is queried on the base PF netdev, not on the VMDq or FCoE netdev.
*/ staticconststruct i40e_stats i40e_gstrings_stats[] = {
I40E_PF_STAT("port.rx_bytes", statsifpause- ! ) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
I40E_PF_STAT("port.rx_unicast -;
I40E_PF_STAT("port.tx_unicast", stats.eth.tx_unicast
I40E_PF_STAT("port.rx_multicast", stats
I40E_PF_STAT("port.tx_multicast", stats.java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
I40E_PF_STAT("port.rx_broadcast", stats if!test_bit(_I40E_DOWN pf->tate &!s_an{
I40E_PF_STAT( /
("." ..)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
I40E_PF_STAT("port.rx_discards", statsnetdev_infonetdev" did not complete changing settingsmaynot result in change.\";
I40E_PF_STAT("port.tx_dropped_link_down", stats.tx_dropped_link_down),
I40E_PF_STAT("port.rx_crc_errors", stats.crc_errors),
I40E_PF_STAT("port.illegal_bytes", stats
I40E_PF_STAT("port.mac_local_faults", stats.mac_local_faults
I40E_PF_STAT("port.mac_remote_faults (dcbx_cfg-pfc.) {
I40E_PF_STAT("port.tx_timeout", tx_timeout_countnetdev_info(,
I40E_PF_STAT("port.rx_csum_bad", hw_csum_rx_error) Priority control.Cannot linkflow\n)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
I40E_PF_STAT("port.rx_length_errors", stats.rx_length_errors),
I40E_PF_STAT("port.link_xon_rx", stats.link_xon_rx),
I40E_PF_STAT("port.link_xoff_rx", stats.link_xoff_rx),
link_xon_tx,.,
I40E_PF_STAT("port.link_xoff_tx", stats.link_xoff_tx),
I40E_PF_STAT(" hw->. java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
I40E_PF_STAT("port.rx_size_127", stats.rx_size_127),
I40E_PF_STAT".",.rx_size_255
I40E_PF_STAT("port.rx_size_511", stats.rx_size_511),
(port" .,
I40E_PF_STAT("port.rx_size_1522", stats.rx_size_1522),
I40E_PF_STAT("port.rx_size_big", stats.rx_size_big),
I40E_PF_STAT("port.tx_size_64", stats.tx_size_64) >fcrequested_mode=I40E_FC_TX_PAUSE; else (!pause-rx_pause &!>tx_pause
I40E_PF_STAT("port.tx_size_255", stats.tx_size_255),
I40E_PF_STAT"porttx_size_511", stats.tx_size_511),
I40E_PF_STAT("port.tx_size_1023", stats.tx_size_1023),
I40E_PF_STAT("port.tx_size_1522", stats.tx_size_1522),
I40E_PF_STAT("port.tx_size_big", stats.tx_size_big),
I40E_PF_STAT(else
I40E_PF_STAT("port.rx_fragments", stats.rx_fragments),
I40E_PF_STAT"port.rx_oversize", .rx_oversize),
I40E_PF_STAT("port.rx_jabber", stats.rx_jabber),
I40E_PF_STAT("port.VF_admin_queue_requests", vf_aq_requests),
I40E_PF_STAT("port.arq_overflows", arq_overflows),
I40E_PF_STAT".tx_hwtstamp_timeouts"tx_hwtstamp_timeouts,
I40E_PF_STAT("port.rx_hwtstamp_cleared", rx_hwtstamp_cleared),
I40E_PF_STAT("port.tx_hwtstamp_skipped", tx_hwtstamp_skipped),
I40E_PF_STAT* java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
I40E_PF_STAT("port.fdir_atr_match"status=i40e_set_fc(,aq_failures, );
I40E_PF_STAT("port.fdir_atr_tunnel_match",
I40E_PF_STAT("port.fdir_atr_status", stats.fd_atr_status),
if (aq_failures&I40E_SET_FC_AQ_FAIL_GET {
I40E_PF_STAT("port.fdir_sb_status", stats.fd_sb_status),
/* LPI stats */
I40E_PF_STAT("port.tx_lpi_status (netdev,"fc on call% %n,
I40E_PF_STAT("port.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
I40E_PF_STAT"porttx_lpi_count"stats
I40E_PF_STAT("port.rx_lpi_count", stats.rx_lpi_count),
}
struct i40e_pfc_stats {
u64 priority_xon_rx;
u64 aq_failures& java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
6 ;
u64 priority_xoff_tx;
u64 ()java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
staticconststruct i40e_statse EAGAIN
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
("porttx_priority_%java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 64
I40E_PFC_STAT"ortrx_priority_u_xon_rx ,
I40E_PFC_STAT("port.rx_priority_%u_xoff_rx", priority_xoff_rx),
I40E_PFC_STAT("port.rx_priority_%u_xon_2_xoff", priority_xon_2_xoff),
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
defineI40E_NETDEV_STATS_LEN ARRAY_SIZEi40e_gstrings_net_statsjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
#define I40E_MISC_STATS_LEN java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
#define I40E_VEB_STATS_LEN (ARRAY_SIZE(i40e_gstrings_veb_stats) + \
ARRAY_SIZEi40e_gstrings_veb_tc_stats) * java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
))
#definevoid(struct*etdev u32data
.flag_string = _name, \
.bitno = _bitno, \
.read_only _,java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
staticconststruct i40e_priv_flags i40e_gstrings_priv_flagsifI40E_DEBUG_USER data
ng *
I40E_PRIV_FLAG("MFP", java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
I40E_PRIV_FLAG("total-port-shutdown",
I40E_FLAG_TOTAL_PORT_SHUTDOWN_ENA, (=0;i40e_reg_listi.offset +
I40E_PRIV_FLAG("LinkPolling += i40e_reg_list[]elementsjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENA, 0),
I40E_PRIV_FLAG("java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 0
(hw-atr-eviction I40E_FLAG_HW_ATR_EVICT_ENA java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
I40E_PRIV_FLAG("link-down-on-close *java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
I40E_FLAG_LINK_DOWN_ON_CLOSE_ENA, 0),
I40E_PRIV_FLAG"",I40E_FLAG_LEGACY_RX_ENA ,
I40E_PRIV_FLAG("disable-source-pruning",
I40E_FLAG_SOURCE_PRUNING_DIS, 0),
I40E_PRIV_FLAG("disable-fw-lldp", I40E_FLAG_FW_LLDP_DIS pf=>>;
&>hw
I40E_PRIV_FLAG("base-r-fec", I40E_FLAG_BASE_R_FEC, 0),
("",
I40E_FLAG_VF_VLAN_PRUNING_ENA, 0),
I40E_PRIV_FLAG( unsigned i, j, ri
I40E_FLAG_MDD_AUTO_RESET_VF, 0),
}
/* Private flags with a global effect, restricted to PF 0 */ staticconststruct i40e_priv_flags i40e_gl_gstrings_priv_flags *
I40E_PRIV_FLAG("vf-true-promisc-support",
I40E_FLAG_TRUE_PROMISC_ENA, 0),
};
/** * i40e_partition_setting_complaint - generic complaint for MFP restriction * @pf: the PF struct
**/ staticvoidjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 4
{
dev_info(&pf->pdev->dev, /* loop through the diags reg table for what to print */
=java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 8
}
/** * i40e_phy_type_to_ethtool - convert the phy_types to ethtool link modes * @pf: PF struct with phy_types * @ks: ethtool link ksettings struct to fill out *
**/ staticvoid i40e_phy_type_to_ethtool(struct i40e_pf *pf, struct ethtool_link_ksettings *ks)
{ struct i40e_link_status *hw_link_info = &pf->hw.phy.link_info;
java.lang.StringIndexOutOfBoundsException: Range [4, 2) out of bounds for length 38
/** * i40e_get_settings_link_up - Get the Link settings for when link is up * @hw: hw structure * @ks: ethtool ksettings to fill in * @netdev: network interface device structure * @pf: pointer to physical function struct
**/ staticvoid i40e_get_settings_link_up(struct i40e_hw *hw, struct ethtool_link_ksettings *ks, struct net_device *netdev, struct i40e_pf *pf)
{ struct i40e_link_status *hw_link_info = &hw->phy.link_info; struct ethtool_link_ksettings cap_ksettings;
u32 link_speed = hw_link_info->link_speed;
/* Initialize supported and advertised settings based on phy settings */ switch (hw_link_info->phy_type) { case I40E_PHY_TYPE_40GBASE_CR4: case I40E_PHY_TYPE_40GBASE_CR4_CU:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
40000baseCR4_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising,
40000baseCR4_Full); break; case I40E_PHY_TYPE_XLAUI: case I40E_PHY_TYPE_XLPPI: case I40E_PHY_TYPE_40GBASE_AOC:
ethtool_link_ksettings_add_link_mode(ks, supported,
40000baseCR4_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
40000baseCR4_Full); break; case I40E_PHY_TYPE_40GBASE_SR4:
ethtool_link_ksettings_add_link_mode(ks, supported,
40000baseSR4_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
40000baseSR4_Full); break; case I40E_PHY_TYPE_40GBASE_LR4:
ethtool_link_ksettings_add_link_mode(ks, supported,
40000baseLR4_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
40000baseLR4_Full); break; case I40E_PHY_TYPE_25GBASE_SR: case I40E_PHY_TYPE_25GBASE_LR: case I40E_PHY_TYPE_10GBASE_SR: case I40E_PHY_TYPE_10GBASE_LR: case I40E_PHY_TYPE_1000BASE_SX: case I40E_PHY_TYPE_1000BASE_LX:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
25000baseSR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
25000baseSR_Full);
i40e_get_settings_link_up_fec(hw_link_info->req_fec_info, ks);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseSR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseSR_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseLR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseLR_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
1000baseX_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
1000baseX_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseT_Full); if (hw_link_info->module_type[2] &
I40E_MODULE_TYPE_1000BASE_SX ||
hw_link_info->module_type[2] &
I40E_MODULE_TYPE_1000BASE_LX) {
ethtool_link_ksettings_add_link_mode(ks, supported,
1000baseT_Full); if (hw_link_info->requested_speeds &
I40E_LINK_SPEED_1GB)
ethtool_link_ksettings_add_link_mode(
ks, advertising, 1000baseT_Full);
} if (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseT_Full); break; case I40E_PHY_TYPE_10GBASE_T: case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: case I40E_PHY_TYPE_1000BASE_T: case I40E_PHY_TYPE_100BASE_TX:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
5000baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
2500baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
1000baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
100baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseT_Full); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_5GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
5000baseT_Full); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_2_5GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
2500baseT_Full); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
1000baseT_Full); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_100MB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
100baseT_Full); break; case I40E_PHY_TYPE_1000BASE_T_OPTICAL:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
1000baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising,
1000baseT_Full); break; case I40E_PHY_TYPE_10GBASE_CR1_CU: case I40E_PHY_TYPE_10GBASE_CR1:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseT_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseT_Full); break; case I40E_PHY_TYPE_XAUI: case I40E_PHY_TYPE_XFI: case I40E_PHY_TYPE_SFI: case I40E_PHY_TYPE_10GBASE_SFPP_CU: case I40E_PHY_TYPE_10GBASE_AOC:
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseT_Full); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseT_Full);
i40e_get_settings_link_up_fec(hw_link_info->req_fec_info, ks); break; case I40E_PHY_TYPE_SGMII:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
1000baseT_Full); if (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)
ethtool_link_ksettings_add_link_mode(ks, advertising,
1000baseT_Full); if (test_bit(I40E_HW_CAP_100M_SGMII, pf->hw.caps)) {
ethtool_link_ksettings_add_link_mode(ks, supported,
100baseT_Full); if (hw_link_info->requested_speeds &
I40E_LINK_SPEED_100MB)
ethtool_link_ksettings_add_link_mode(
ks, advertising, 100baseT_Full);
} break; case I40E_PHY_TYPE_40GBASE_KR4: case I40E_PHY_TYPE_25GBASE_KR: case I40E_PHY_TYPE_20GBASE_KR2: case I40E_PHY_TYPE_10GBASE_KR: case I40E_PHY_TYPE_10GBASE_KX4: case I40E_PHY_TYPE_1000BASE_KX:
ethtool_link_ksettings_add_link_mode(ks, supported,
40000baseKR4_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
25000baseKR_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
20000baseKR2_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseKR_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseKX4_Full);
ethtool_link_ksettings_add_link_mode(ks, supported,
1000baseKX_Full);
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising,
40000baseKR4_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
25000baseKR_Full);
i40e_get_settings_link_up_fec(hw_link_info->req_fec_info, ks);
ethtool_link_ksettings_add_link_mode(ks, advertising,
20000baseKR2_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseKR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseKX4_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
1000baseKX_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg); break; case I40E_PHY_TYPE_25GBASE_CR:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
25000baseCR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
25000baseCR_Full);
i40e_get_settings_link_up_fec(hw_link_info->req_fec_info, ks);
break; case I40E_PHY_TYPE_25GBASE_AOC: case I40E_PHY_TYPE_25GBASE_ACC:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported,
25000baseCR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
25000baseCR_Full);
i40e_get_settings_link_up_fec(hw_link_info->req_fec_info, ks);
ethtool_link_ksettings_add_link_mode(ks, supported,
10000baseCR_Full);
ethtool_link_ksettings_add_link_mode(ks, advertising,
10000baseCR_Full); break; default: /* if we got here and link is up something bad is afoot */
netdev_info(netdev, "WARNING: Link is up but PHY type 0x%x is not recognized, or incorrect cable is in use\n",
hw_link_info->phy_type);
}
/* Now that we've worked out everything that could be supported by the * current PHY type, get what is supported by the NVM and intersect * them to get what is truly supported
*/
memset(&cap_ksettings, 0, sizeof(struct ethtool_link_ksettings));
i40e_phy_type_to_ethtool(pf, &cap_ksettings);
ethtool_intersect_link_masks(ks, &cap_ksettings);
/* Set speed and duplex */ switch (link_speed) { case I40E_LINK_SPEED_40GB:
ks->base.speed = SPEED_40000; break; case I40E_LINK_SPEED_25GB:
ks->base.speed = SPEED_25000; break; case I40E_LINK_SPEED_20GB:
ks->base.speed = SPEED_20000; break; case I40E_LINK_SPEED_10GB:
ks->base.speed = SPEED_10000; break; case I40E_LINK_SPEED_5GB:
ks->base.speed = SPEED_5000; break; case I40E_LINK_SPEED_2_5GB:
ks->base.speed = SPEED_2500; break; case I40E_LINK_SPEED_1GB:
ks->base.speed = SPEED_1000; break; case I40E_LINK_SPEED_100MB:
ks->base.speed = SPEED_100; break; default:
ks->base.speed = SPEED_UNKNOWN; break;
}
ks->base.duplex = DUPLEX_FULL;
}
/** * i40e_get_settings_link_down - Get the Link settings for when link is down * @hw: hw structure * @ks: ethtool ksettings to fill in * @pf: pointer to physical function struct * * Reports link settings that can be determined when link is down
**/ staticvoid i40e_get_settings_link_down(struct i40e_hw *hw, struct ethtool_link_ksettings *ks, struct i40e_pf *pf)
{ /* link is down and the driver needs to fall back on * supported phy types to figure out what info to display
*/
i40e_phy_type_to_ethtool(pf, ks);
/* With no link speed and duplex are unknown */
ks->base.speed = SPEED_UNKNOWN;
ks->base.duplex = DUPLEX_UNKNOWN;
}
if (link_up)
i40e_get_settings_link_up(hw, ks, netdev, pf); else
i40e_get_settings_link_down(hw, ks, pf);
/* Now set the settings that don't rely on link being up/down */ /* Set autoneg settings */
ks->base.autoneg = ((hw_link_info->an_info & I40E_AQ_AN_COMPLETED) ?
AUTONEG_ENABLE : AUTONEG_DISABLE);
/* Set media type settings */ switch (hw->phy.media_type) { case I40E_MEDIA_TYPE_BACKPLANE:
ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, supported, Backplane);
ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
ethtool_link_ksettings_add_link_mode(ks, advertising,
Backplane);
ks->base.port = PORT_NONE; break; case I40E_MEDIA_TYPE_BASET:
ethtool_link_ksettings_add_link_mode(ks, supported, TP);
ethtool_link_ksettings_add_link_mode(ks, advertising, TP);
ks->base.port = PORT_TP; break; case I40E_MEDIA_TYPE_DA: case I40E_MEDIA_TYPE_CX4:
ethtool_link_ksettings_add_link_mode(ks, supported, FIBRE);
ethtool_link_ksettings_add_link_mode(ks, advertising, FIBRE);
ks->base.port = PORT_DA; break; case I40E_MEDIA_TYPE_FIBER:
ethtool_link_ksettings_add_link_mode(ks, supported, FIBRE);
ethtool_link_ksettings_add_link_mode(ks, advertising, FIBRE);
ks->base.port = PORT_FIBRE; break; case I40E_MEDIA_TYPE_UNKNOWN: default:
ks->base.port = PORT_OTHER; break;
}
/* Set flow control settings */
ethtool_link_ksettings_add_link_mode(ks, supported, Pause);
ethtool_link_ksettings_add_link_mode(ks, supported, Asym_Pause);
/* save autoneg out of ksettings */
autoneg = copy_ks.base.autoneg;
speed = copy_ks.base.speed;
/* get our own copy of the bits to check against */
memset(&safe_ks, 0, sizeof(struct ethtool_link_ksettings));
safe_ks.base.cmd = copy_ks.base.cmd;
safe_ks.base.link_mode_masks_nwords =
copy_ks.base.link_mode_masks_nwords;
i40e_get_link_ksettings(netdev, &safe_ks);
/* Get link modes supported by hardware and check against modes * requested by the user. Return an error if unsupported mode was set.
*/ if (!bitmap_subset(copy_ks.link_modes.advertising,
safe_ks.link_modes.supported,
__ETHTOOL_LINK_MODE_MASK_NBITS)) return -EINVAL;
/* set autoneg back to what it currently is */
copy_ks.base.autoneg = safe_ks.base.autoneg;
copy_ks.base.speed = safe_ks.base.speed;
while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) {
timeout--; if (!timeout) return -EBUSY;
usleep_range(1000, 2000);
}
/* Get the current phy config */
status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,
NULL); if (status) {
err = -EAGAIN; goto done;
}
/* Copy abilities to config in case autoneg is not * set below
*/
memset(&config, 0, sizeof(struct i40e_aq_set_phy_config));
config.abilities = abilities.abilities;
/* Check autoneg */ if (autoneg == AUTONEG_ENABLE) { /* If autoneg was not already enabled */ if (!(hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED)) { /* If autoneg is not supported, return error */ if (!ethtool_link_ksettings_test_link_mode(&safe_ks,
supported,
Autoneg)) {
netdev_info(netdev, "Autoneg not supported on this phy\n");
err = -EINVAL; goto done;
} /* Autoneg is allowed to change */
config.abilities = abilities.abilities |
I40E_AQ_PHY_ENABLE_AN;
autoneg_changed = true;
}
} else { /* If autoneg is currently enabled */ if (hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED) { /* If autoneg is supported 10GBASE_T is the only PHY * that can disable it, so otherwise return error
*/ if (ethtool_link_ksettings_test_link_mode(&safe_ks,
supported,
Autoneg) &&
hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
netdev_info(netdev, "Autoneg cannot be disabled on this phy\n");
err = -EINVAL; goto done;
} /* Autoneg is allowed to change */
config.abilities = abilities.abilities &
~I40E_AQ_PHY_ENABLE_AN;
autoneg_changed = true;
}
}
/* Autonegotiation must be disabled to change speed */ if ((speed != SPEED_UNKNOWN && safe_ks.base.speed != speed) &&
(autoneg == AUTONEG_DISABLE ||
(safe_ks.base.autoneg == AUTONEG_DISABLE && !autoneg_changed))) {
link_speed = i40e_speed_to_link_speed(speed, ks); if (link_speed == I40E_LINK_SPEED_UNKNOWN) {
netdev_info(netdev, "Given speed is not supported\n");
err = -EOPNOTSUPP; goto done;
} else {
config.link_speed = link_speed;
}
} else { if (safe_ks.base.speed != speed) {
netdev_info(netdev, "Unable to set speed, disable autoneg\n");
err = -EOPNOTSUPP; goto done;
}
}
/* If speed didn't get set, set it to what it currently is. * This is needed because if advertise is 0 (as it is when autoneg * is disabled) then speed won't get set.
*/ if (!config.link_speed)
config.link_speed = abilities.link_speed; if (autoneg_changed || abilities.link_speed != config.link_speed) { /* copy over the rest of the abilities */
config.phy_type = abilities.phy_type;
config.phy_type_ext = abilities.phy_type_ext;
config.eee_capability = abilities.eee_capability;
config.eeer = abilities.eeer_val;
config.low_power_ctrl = abilities.d3_lpan;
config.fec_config = abilities.fec_cfg_curr_mod_ext_info &
I40E_AQ_PHY_FEC_CONFIG_MASK;
/* save the requested speeds */
hw->phy.link_info.requested_speeds = config.link_speed; /* set link and auto negotiation so changes take effect */
config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK; /* If link is up put link down */ if (hw->phy.link_info.link_info & I40E_AQ_LINK_UP) { /* Tell the OS link is going down, the link will go * back up when fw says it is ready asynchronously
*/
i40e_print_link_message(vsi, false);
netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
}
/* make the aq call */
status = i40e_aq_set_phy_config(hw, &config, NULL); if (status) {
netdev_info(netdev, "Set phy config failed, err %pe aq_err %s\n",
ERR_PTR(status),
libie_aq_str(hw->aq.asq_last_status));
err = -EAGAIN; goto done;
}
status = i40e_update_link_info(hw); if (status)
netdev_dbg(netdev, "Updating link info failed with err %pe aq_err %s\n",
ERR_PTR(status),
libie_aq_str(hw->aq.asq_last_status));
/* Changing the port's flow control is not supported if this isn't the * port's controlling PF
*/ if (hw->partition_id != 1) {
i40e_partition_setting_complaint(pf); return -EOPNOTSUPP;
}
if (vsi->type != I40E_VSI_MAIN) return -EOPNOTSUPP;
/* If we have link and don't have autoneg */ if (!test_bit(__I40E_DOWN, pf->state) && !is_an) { /* Send message that it might not necessarily work*/
netdev_info(netdev, "Autoneg did not complete so changing settings may not result in an actual change.\n");
}
if (dcbx_cfg->pfc.pfcenable) {
netdev_info(netdev, "Priority flow control enabled. Cannot set link flow control.\n"); return -EOPNOTSUPP;
}
/* Tell the OS link is going down, the link will go back up when fw * says it is ready asynchronously
*/
i40e_print_link_message(vsi, false);
netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
/* Set the fc mode and only restart an if link is up*/
status = i40e_set_fc(hw, &aq_failures, link_up);
if (aq_failures & I40E_SET_FC_AQ_FAIL_GET) {
netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %pe aq_err %s\n",
ERR_PTR(status),
libie_aq_str(hw->aq.asq_last_status));
err = -EAGAIN;
} if (aq_failures & I40E_SET_FC_AQ_FAIL_SET) {
netdev_info(netdev, "Set fc failed on the set_phy_config call with err %pe aq_err %s\n",
ERR_PTR(status),
libie_aq_str(hw->aq.asq_last_status));
err = -EAGAIN;
} if (aq_failures & I40E_SET_FC_AQ_FAIL_UPDATE) {
netdev_info(netdev, "Set fc failed on the get_link_info call with err %pe aq_err %s\n",
ERR_PTR(status),
libie_aq_str(hw->aq.asq_last_status));
err = -EAGAIN;
}
if (!test_bit(__I40E_DOWN, pf->state) && is_an) { /* Give it a little more time to try to come back */
msleep(75); if (!test_bit(__I40E_DOWN, pf->state)) return i40e_nway_reset(netdev);
}
/* Tell ethtool which driver-version-specific regs output we have. * * At some point, if we have ethtool doing special formatting of * this data, it will rely on this version number to know how to * interpret things. Hence, this needs to be updated if/when the * diags register table is changed.
*/
regs->version = 1;
/* loop through the diags reg table for what to print */
ri = 0; for (i = 0; i40e_reg_list[i].offset != 0; i++) { for (j = 0; j < i40e_reg_list[i].elements; j++) {
reg = i40e_reg_list[i].offset
+ (j * i40e_reg_list[i].stride);
reg_buf[ri++] = rd32(hw, reg);
}
}
/* make sure it is the right magic for NVMUpdate */ if ((eeprom->magic >> 16) != hw->device_id)
errno = -EINVAL; elseif (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
test_bit(__I40E_RESET_INTR_RECEIVED, pf->state))
errno = -EBUSY; else
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.