Merge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 10GbE Intel Wired LAN Driver Updates 2019-11-04 This series contains old Halloween candy updates, yet still sweet, to fm10k, ixgbe and i40e. Jake adds the missing initializers for a couple of the TLV attribute macros. Added support for capturing and reporting statistics for all of the VFs in a given PF. Lastly, bump the version of the fm10k driver to reflect the recent changes. Alex addresses locality issues in the ixgbe driver when it is loaded on a system supporting multiple NUMA nodes. Manjunath Patil provides changes to the ixgbe driver, similar to those made to igb, to prevent transmit packets to request a hardware timestamp when the NIC has not been setup via the SIOCSHWTSTAMP ioctl. Alice adds support for x710 by adding the missing device id's in the appropriate places to ensure all the features are enabled in i40e. Jesse adds support for VF stats gathering in the i40e via the kernel via ndo_get_vf_stats function. v2: Fixed up commit id references in patch 5's description to align with how commit id's should be referenced. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Коммит
eeb2045bb7
|
@ -534,6 +534,7 @@ void fm10k_iov_suspend(struct pci_dev *pdev);
|
|||
int fm10k_iov_resume(struct pci_dev *pdev);
|
||||
void fm10k_iov_disable(struct pci_dev *pdev);
|
||||
int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs);
|
||||
void fm10k_iov_update_stats(struct fm10k_intfc *interface);
|
||||
s32 fm10k_iov_update_pvid(struct fm10k_intfc *interface, u16 glort, u16 pvid);
|
||||
int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac);
|
||||
int fm10k_ndo_set_vf_vlan(struct net_device *netdev,
|
||||
|
@ -542,6 +543,8 @@ int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
|
|||
int __always_unused min_rate, int max_rate);
|
||||
int fm10k_ndo_get_vf_config(struct net_device *netdev,
|
||||
int vf_idx, struct ifla_vf_info *ivi);
|
||||
int fm10k_ndo_get_vf_stats(struct net_device *netdev,
|
||||
int vf_idx, struct ifla_vf_stats *stats);
|
||||
|
||||
/* DebugFS */
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
|
|
@ -520,6 +520,27 @@ int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs)
|
|||
return num_vfs;
|
||||
}
|
||||
|
||||
/**
|
||||
* fm10k_iov_update_stats - Update stats for all VFs
|
||||
* @interface: device private structure
|
||||
*
|
||||
* Updates the VF statistics for all enabled VFs. Expects to be called by
|
||||
* fm10k_update_stats and assumes that locking via the __FM10K_UPDATING_STATS
|
||||
* bit is already handled.
|
||||
*/
|
||||
void fm10k_iov_update_stats(struct fm10k_intfc *interface)
|
||||
{
|
||||
struct fm10k_iov_data *iov_data = interface->iov_data;
|
||||
struct fm10k_hw *hw = &interface->hw;
|
||||
int i;
|
||||
|
||||
if (!iov_data)
|
||||
return;
|
||||
|
||||
for (i = 0; i < iov_data->num_vfs; i++)
|
||||
hw->iov.ops.update_stats(hw, iov_data->vf_info[i].stats, i);
|
||||
}
|
||||
|
||||
static inline void fm10k_reset_vf_info(struct fm10k_intfc *interface,
|
||||
struct fm10k_vf_info *vf_info)
|
||||
{
|
||||
|
@ -650,3 +671,30 @@ int fm10k_ndo_get_vf_config(struct net_device *netdev,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fm10k_ndo_get_vf_stats(struct net_device *netdev,
|
||||
int vf_idx, struct ifla_vf_stats *stats)
|
||||
{
|
||||
struct fm10k_intfc *interface = netdev_priv(netdev);
|
||||
struct fm10k_iov_data *iov_data = interface->iov_data;
|
||||
struct fm10k_hw *hw = &interface->hw;
|
||||
struct fm10k_hw_stats_q *hw_stats;
|
||||
u32 idx, qpp;
|
||||
|
||||
/* verify SR-IOV is active and that vf idx is valid */
|
||||
if (!iov_data || vf_idx >= iov_data->num_vfs)
|
||||
return -EINVAL;
|
||||
|
||||
qpp = fm10k_queues_per_pool(hw);
|
||||
hw_stats = iov_data->vf_info[vf_idx].stats;
|
||||
|
||||
for (idx = 0; idx < qpp; idx++) {
|
||||
stats->rx_packets += hw_stats[idx].rx_packets.count;
|
||||
stats->tx_packets += hw_stats[idx].tx_packets.count;
|
||||
stats->rx_bytes += hw_stats[idx].rx_bytes.count;
|
||||
stats->tx_bytes += hw_stats[idx].tx_bytes.count;
|
||||
stats->rx_dropped += hw_stats[idx].rx_drops.count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "fm10k.h"
|
||||
|
||||
#define DRV_VERSION "0.26.1-k"
|
||||
#define DRV_VERSION "0.27.1-k"
|
||||
#define DRV_SUMMARY "Intel(R) Ethernet Switch Host Interface Driver"
|
||||
const char fm10k_driver_version[] = DRV_VERSION;
|
||||
char fm10k_driver_name[] = "fm10k";
|
||||
|
|
|
@ -1643,6 +1643,7 @@ static const struct net_device_ops fm10k_netdev_ops = {
|
|||
.ndo_set_vf_vlan = fm10k_ndo_set_vf_vlan,
|
||||
.ndo_set_vf_rate = fm10k_ndo_set_vf_bw,
|
||||
.ndo_get_vf_config = fm10k_ndo_get_vf_config,
|
||||
.ndo_get_vf_stats = fm10k_ndo_get_vf_stats,
|
||||
.ndo_udp_tunnel_add = fm10k_udp_tunnel_add,
|
||||
.ndo_udp_tunnel_del = fm10k_udp_tunnel_del,
|
||||
.ndo_dfwd_add_station = fm10k_dfwd_add_station,
|
||||
|
|
|
@ -630,6 +630,9 @@ void fm10k_update_stats(struct fm10k_intfc *interface)
|
|||
net_stats->rx_errors = rx_errors;
|
||||
net_stats->rx_dropped = interface->stats.nodesc_drop.count;
|
||||
|
||||
/* Update VF statistics */
|
||||
fm10k_iov_update_stats(interface);
|
||||
|
||||
clear_bit(__FM10K_UPDATING_STATS, interface->state);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 2013 - 2018 Intel Corporation. */
|
||||
/* Copyright(c) 2013 - 2019 Intel Corporation. */
|
||||
|
||||
#ifndef _FM10K_TLV_H_
|
||||
#define _FM10K_TLV_H_
|
||||
|
@ -76,8 +76,8 @@ struct fm10k_tlv_attr {
|
|||
#define FM10K_TLV_ATTR_S32(id) { id, FM10K_TLV_SIGNED, 4 }
|
||||
#define FM10K_TLV_ATTR_S64(id) { id, FM10K_TLV_SIGNED, 8 }
|
||||
#define FM10K_TLV_ATTR_LE_STRUCT(id, len) { id, FM10K_TLV_LE_STRUCT, len }
|
||||
#define FM10K_TLV_ATTR_NESTED(id) { id, FM10K_TLV_NESTED }
|
||||
#define FM10K_TLV_ATTR_LAST { FM10K_TLV_ERROR }
|
||||
#define FM10K_TLV_ATTR_NESTED(id) { id, FM10K_TLV_NESTED, 0 }
|
||||
#define FM10K_TLV_ATTR_LAST { FM10K_TLV_ERROR, 0, 0 }
|
||||
|
||||
struct fm10k_msg_data {
|
||||
unsigned int id;
|
||||
|
|
|
@ -581,6 +581,7 @@ struct fm10k_vf_info {
|
|||
* at the same offset as the mailbox
|
||||
*/
|
||||
struct fm10k_mbx_info mbx; /* PF side of VF mailbox */
|
||||
struct fm10k_hw_stats_q stats[FM10K_MAX_QUEUES_POOL];
|
||||
int rate; /* Tx BW cap as defined by OS */
|
||||
u16 glort; /* resource tag for this VF */
|
||||
u16 sw_vid; /* Switch API assigned VLAN */
|
||||
|
|
|
@ -29,6 +29,7 @@ i40e_status i40e_set_mac_type(struct i40e_hw *hw)
|
|||
case I40E_DEV_ID_QSFP_C:
|
||||
case I40E_DEV_ID_10G_BASE_T:
|
||||
case I40E_DEV_ID_10G_BASE_T4:
|
||||
case I40E_DEV_ID_10G_BASE_T_BC:
|
||||
case I40E_DEV_ID_10G_B:
|
||||
case I40E_DEV_ID_10G_SFP:
|
||||
case I40E_DEV_ID_20G_KR2:
|
||||
|
@ -4910,6 +4911,7 @@ i40e_status i40e_write_phy_register(struct i40e_hw *hw,
|
|||
break;
|
||||
case I40E_DEV_ID_10G_BASE_T:
|
||||
case I40E_DEV_ID_10G_BASE_T4:
|
||||
case I40E_DEV_ID_10G_BASE_T_BC:
|
||||
case I40E_DEV_ID_10G_BASE_T_X722:
|
||||
case I40E_DEV_ID_25G_B:
|
||||
case I40E_DEV_ID_25G_SFP28:
|
||||
|
|
|
@ -12870,6 +12870,7 @@ static const struct net_device_ops i40e_netdev_ops = {
|
|||
.ndo_set_features = i40e_set_features,
|
||||
.ndo_set_vf_mac = i40e_ndo_set_vf_mac,
|
||||
.ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan,
|
||||
.ndo_get_vf_stats = i40e_get_vf_stats,
|
||||
.ndo_set_vf_rate = i40e_ndo_set_vf_bw,
|
||||
.ndo_get_vf_config = i40e_ndo_get_vf_config,
|
||||
.ndo_set_vf_link_state = i40e_ndo_set_vf_link_state,
|
||||
|
|
|
@ -4524,3 +4524,51 @@ out:
|
|||
clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_get_vf_stats - populate some stats for the VF
|
||||
* @netdev: the netdev of the PF
|
||||
* @vf_id: the host OS identifier (0-127)
|
||||
* @vf_stats: pointer to the OS memory to be initialized
|
||||
*/
|
||||
int i40e_get_vf_stats(struct net_device *netdev, int vf_id,
|
||||
struct ifla_vf_stats *vf_stats)
|
||||
{
|
||||
struct i40e_netdev_priv *np = netdev_priv(netdev);
|
||||
struct i40e_pf *pf = np->vsi->back;
|
||||
struct i40e_eth_stats *stats;
|
||||
struct i40e_vsi *vsi;
|
||||
struct i40e_vf *vf;
|
||||
|
||||
/* validate the request */
|
||||
if (i40e_validate_vf(pf, vf_id))
|
||||
return -EINVAL;
|
||||
|
||||
vf = &pf->vf[vf_id];
|
||||
if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
|
||||
dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
vsi = pf->vsi[vf->lan_vsi_idx];
|
||||
if (!vsi)
|
||||
return -EINVAL;
|
||||
|
||||
i40e_update_eth_stats(vsi);
|
||||
stats = &vsi->eth_stats;
|
||||
|
||||
memset(vf_stats, 0, sizeof(*vf_stats));
|
||||
|
||||
vf_stats->rx_packets = stats->rx_unicast + stats->rx_broadcast +
|
||||
stats->rx_multicast;
|
||||
vf_stats->tx_packets = stats->tx_unicast + stats->tx_broadcast +
|
||||
stats->tx_multicast;
|
||||
vf_stats->rx_bytes = stats->rx_bytes;
|
||||
vf_stats->tx_bytes = stats->tx_bytes;
|
||||
vf_stats->broadcast = stats->rx_broadcast;
|
||||
vf_stats->multicast = stats->rx_multicast;
|
||||
vf_stats->rx_dropped = stats->rx_discards;
|
||||
vf_stats->tx_dropped = stats->tx_discards;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -138,5 +138,7 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);
|
|||
|
||||
void i40e_vc_notify_link_state(struct i40e_pf *pf);
|
||||
void i40e_vc_notify_reset(struct i40e_pf *pf);
|
||||
int i40e_get_vf_stats(struct net_device *netdev, int vf_id,
|
||||
struct ifla_vf_stats *vf_stats);
|
||||
|
||||
#endif /* _I40E_VIRTCHNL_PF_H_ */
|
||||
|
|
|
@ -832,9 +832,9 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
|
|||
int xdp_count, int xdp_idx,
|
||||
int rxr_count, int rxr_idx)
|
||||
{
|
||||
int node = dev_to_node(&adapter->pdev->dev);
|
||||
struct ixgbe_q_vector *q_vector;
|
||||
struct ixgbe_ring *ring;
|
||||
int node = NUMA_NO_NODE;
|
||||
int cpu = -1;
|
||||
int ring_count;
|
||||
u8 tcs = adapter->hw_tcs;
|
||||
|
@ -845,12 +845,10 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
|
|||
if ((tcs <= 1) && !(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) {
|
||||
u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
|
||||
if (rss_i > 1 && adapter->atr_sample_rate) {
|
||||
if (cpu_online(v_idx)) {
|
||||
cpu = v_idx;
|
||||
cpu = cpumask_local_spread(v_idx, node);
|
||||
node = cpu_to_node(cpu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate q_vector and rings */
|
||||
q_vector = kzalloc_node(struct_size(q_vector, ring, ring_count),
|
||||
|
|
|
@ -8649,7 +8649,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
|
|||
|
||||
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
|
||||
adapter->ptp_clock) {
|
||||
if (!test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
|
||||
if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON &&
|
||||
!test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
|
||||
&adapter->state)) {
|
||||
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
|
||||
tx_flags |= IXGBE_TX_FLAGS_TSTAMP;
|
||||
|
|
Загрузка…
Ссылка в новой задаче