2018-09-20 08:42:55 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright (c) 2018, Intel Corporation. */
|
|
|
|
|
|
|
|
#ifndef _ICE_VIRTCHNL_PF_H_
|
|
|
|
#define _ICE_VIRTCHNL_PF_H_
|
|
|
|
#include "ice.h"
|
|
|
|
|
2018-09-20 08:43:01 +08:00
|
|
|
/* Restrict number of MAC Addr and VLAN that non-trusted VF can programmed */
|
|
|
|
#define ICE_MAX_VLAN_PER_VF 8
|
2018-09-20 08:42:59 +08:00
|
|
|
#define ICE_MAX_MACADDR_PER_VF 12
|
2018-09-20 08:43:01 +08:00
|
|
|
|
|
|
|
/* Malicious Driver Detection */
|
2018-09-20 08:42:59 +08:00
|
|
|
#define ICE_DFLT_NUM_INVAL_MSGS_ALLOWED 10
|
2019-07-25 17:53:58 +08:00
|
|
|
#define ICE_MDD_EVENTS_THRESHOLD 30
|
2018-09-20 08:42:58 +08:00
|
|
|
|
2018-09-20 08:42:55 +08:00
|
|
|
/* Static VF transaction/status register def */
|
|
|
|
#define VF_DEVICE_STATUS 0xAA
|
|
|
|
#define VF_TRANS_PENDING_M 0x20
|
|
|
|
|
2019-07-25 16:55:37 +08:00
|
|
|
/* wait defines for polling PF_PCI_CIAD register status */
|
|
|
|
#define ICE_PCI_CIAD_WAIT_COUNT 100
|
|
|
|
#define ICE_PCI_CIAD_WAIT_DELAY_US 1
|
|
|
|
|
2020-02-28 02:14:52 +08:00
|
|
|
/* VF resource constraints */
|
2019-07-25 16:55:39 +08:00
|
|
|
#define ICE_MAX_VF_COUNT 256
|
|
|
|
#define ICE_MIN_QS_PER_VF 1
|
|
|
|
#define ICE_NONQ_VECS_VF 1
|
|
|
|
#define ICE_MAX_SCATTER_QS_PER_VF 16
|
2020-02-28 02:14:52 +08:00
|
|
|
#define ICE_MAX_RSS_QS_PER_VF 16
|
|
|
|
#define ICE_NUM_VF_MSIX_MED 17
|
|
|
|
#define ICE_NUM_VF_MSIX_SMALL 5
|
2019-07-25 16:55:39 +08:00
|
|
|
#define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1)
|
2020-02-19 05:22:06 +08:00
|
|
|
#define ICE_MAX_VF_RESET_TRIES 40
|
|
|
|
#define ICE_MAX_VF_RESET_SLEEP_MS 20
|
2019-07-25 16:55:39 +08:00
|
|
|
|
2019-12-12 19:12:56 +08:00
|
|
|
#define ice_for_each_vf(pf, i) \
|
|
|
|
for ((i) = 0; (i) < (pf)->num_alloc_vfs; (i)++)
|
|
|
|
|
2018-09-20 08:42:55 +08:00
|
|
|
/* Specific VF states */
|
|
|
|
enum ice_vf_states {
|
2019-08-02 16:25:20 +08:00
|
|
|
ICE_VF_STATE_INIT = 0, /* PF is initializing VF */
|
|
|
|
ICE_VF_STATE_ACTIVE, /* VF resources are allocated for use */
|
|
|
|
ICE_VF_STATE_QS_ENA, /* VF queue(s) enabled */
|
2018-09-20 08:42:55 +08:00
|
|
|
ICE_VF_STATE_DIS,
|
|
|
|
ICE_VF_STATE_MC_PROMISC,
|
|
|
|
ICE_VF_STATE_UC_PROMISC,
|
|
|
|
ICE_VF_STATES_NBITS
|
|
|
|
};
|
|
|
|
|
|
|
|
/* VF capabilities */
|
|
|
|
enum ice_virtchnl_cap {
|
|
|
|
ICE_VIRTCHNL_VF_CAP_L2 = 0,
|
|
|
|
ICE_VIRTCHNL_VF_CAP_PRIVILEGE,
|
|
|
|
};
|
|
|
|
|
2020-02-14 05:31:16 +08:00
|
|
|
/* VF MDD events print structure */
|
|
|
|
struct ice_mdd_vf_events {
|
|
|
|
u16 count; /* total count of Rx|Tx events */
|
|
|
|
/* count number of the last printed event */
|
|
|
|
u16 last_printed;
|
|
|
|
};
|
|
|
|
|
2018-09-20 08:42:55 +08:00
|
|
|
/* VF information structure */
|
|
|
|
struct ice_vf {
|
|
|
|
struct ice_pf *pf;
|
|
|
|
|
2019-02-20 07:04:13 +08:00
|
|
|
s16 vf_id; /* VF ID in the PF space */
|
ice: Reorganize ice_vf struct
The ice_vf struct can be used hundreds of times in our
driver so it pays to use less memory per struct.
ice_vf prior to this commit:
/* size: 112, cachelines: 2, members: 25 */
/* sum members: 101, holes: 4, sum holes: 8 */
/* bit holes: 2, sum bit holes: 11 bits */
/* padding: 3 */
/* last cacheline: 48 bytes */
ice_vf after this commit:
/* size: 104, cachelines: 2, members: 25 */
/* sum members: 100, holes: 3, sum holes: 4 */
/* bit holes: 1, sum bit holes: 3 bits */
/* last cacheline: 40 bytes */
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
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>
2019-04-17 01:24:36 +08:00
|
|
|
u16 lan_vsi_idx; /* index into PF struct */
|
2019-07-25 16:55:36 +08:00
|
|
|
/* first vector index of this VF in the PF space */
|
|
|
|
int first_vector_idx;
|
2019-02-20 07:04:13 +08:00
|
|
|
struct ice_sw *vf_sw_id; /* switch ID the VF VSIs connect to */
|
2018-09-20 08:42:59 +08:00
|
|
|
struct virtchnl_version_info vf_ver;
|
ice: Reorganize ice_vf struct
The ice_vf struct can be used hundreds of times in our
driver so it pays to use less memory per struct.
ice_vf prior to this commit:
/* size: 112, cachelines: 2, members: 25 */
/* sum members: 101, holes: 4, sum holes: 8 */
/* bit holes: 2, sum bit holes: 11 bits */
/* padding: 3 */
/* last cacheline: 48 bytes */
ice_vf after this commit:
/* size: 104, cachelines: 2, members: 25 */
/* sum members: 100, holes: 3, sum holes: 4 */
/* bit holes: 1, sum bit holes: 3 bits */
/* last cacheline: 40 bytes */
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
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>
2019-04-17 01:24:36 +08:00
|
|
|
u32 driver_caps; /* reported by VF driver */
|
2018-09-20 08:42:55 +08:00
|
|
|
struct virtchnl_ether_addr dflt_lan_addr;
|
2020-02-28 02:14:52 +08:00
|
|
|
DECLARE_BITMAP(txq_ena, ICE_MAX_RSS_QS_PER_VF);
|
|
|
|
DECLARE_BITMAP(rxq_ena, ICE_MAX_RSS_QS_PER_VF);
|
2020-01-22 23:21:25 +08:00
|
|
|
u16 port_vlan_info; /* Port VLAN ID and QoS */
|
2019-04-17 01:24:35 +08:00
|
|
|
u8 pf_set_mac:1; /* VF MAC address set by VMM admin */
|
|
|
|
u8 trusted:1;
|
ice: Reorganize ice_vf struct
The ice_vf struct can be used hundreds of times in our
driver so it pays to use less memory per struct.
ice_vf prior to this commit:
/* size: 112, cachelines: 2, members: 25 */
/* sum members: 101, holes: 4, sum holes: 8 */
/* bit holes: 2, sum bit holes: 11 bits */
/* padding: 3 */
/* last cacheline: 48 bytes */
ice_vf after this commit:
/* size: 104, cachelines: 2, members: 25 */
/* sum members: 100, holes: 3, sum holes: 4 */
/* bit holes: 1, sum bit holes: 3 bits */
/* last cacheline: 40 bytes */
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
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>
2019-04-17 01:24:36 +08:00
|
|
|
u8 spoofchk:1;
|
|
|
|
u8 link_forced:1;
|
|
|
|
u8 link_up:1; /* only valid if VF link is forced */
|
|
|
|
/* VSI indices - actual VSI pointers are maintained in the PF structure
|
|
|
|
* When assigned, these will be non-zero, because VSI 0 is always
|
|
|
|
* the main LAN VSI for the PF.
|
|
|
|
*/
|
2018-09-20 08:42:55 +08:00
|
|
|
u16 lan_vsi_num; /* ID as used by firmware */
|
ice: Reorganize ice_vf struct
The ice_vf struct can be used hundreds of times in our
driver so it pays to use less memory per struct.
ice_vf prior to this commit:
/* size: 112, cachelines: 2, members: 25 */
/* sum members: 101, holes: 4, sum holes: 8 */
/* bit holes: 2, sum bit holes: 11 bits */
/* padding: 3 */
/* last cacheline: 48 bytes */
ice_vf after this commit:
/* size: 104, cachelines: 2, members: 25 */
/* sum members: 100, holes: 3, sum holes: 4 */
/* bit holes: 1, sum bit holes: 3 bits */
/* last cacheline: 40 bytes */
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
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>
2019-04-17 01:24:36 +08:00
|
|
|
unsigned int tx_rate; /* Tx bandwidth limit in Mbps */
|
|
|
|
DECLARE_BITMAP(vf_states, ICE_VF_STATES_NBITS); /* VF runtime states */
|
|
|
|
|
2018-09-20 08:42:59 +08:00
|
|
|
u64 num_inval_msgs; /* number of continuous invalid msgs */
|
|
|
|
u64 num_valid_msgs; /* number of valid msgs detected */
|
2019-02-20 07:04:13 +08:00
|
|
|
unsigned long vf_caps; /* VF's adv. capabilities */
|
ice: Reorganize ice_vf struct
The ice_vf struct can be used hundreds of times in our
driver so it pays to use less memory per struct.
ice_vf prior to this commit:
/* size: 112, cachelines: 2, members: 25 */
/* sum members: 101, holes: 4, sum holes: 8 */
/* bit holes: 2, sum bit holes: 11 bits */
/* padding: 3 */
/* last cacheline: 48 bytes */
ice_vf after this commit:
/* size: 104, cachelines: 2, members: 25 */
/* sum members: 100, holes: 3, sum holes: 4 */
/* bit holes: 1, sum bit holes: 3 bits */
/* last cacheline: 40 bytes */
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
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>
2019-04-17 01:24:36 +08:00
|
|
|
u8 num_req_qs; /* num of queue pairs requested by VF */
|
2018-09-20 08:42:55 +08:00
|
|
|
u16 num_mac;
|
2019-02-27 08:35:09 +08:00
|
|
|
u16 num_vf_qs; /* num of queue configured per VF */
|
2020-02-14 05:31:16 +08:00
|
|
|
struct ice_mdd_vf_events mdd_rx_events;
|
|
|
|
struct ice_mdd_vf_events mdd_tx_events;
|
2018-09-20 08:42:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_PCI_IOV
|
2018-09-20 08:42:57 +08:00
|
|
|
void ice_process_vflr_event(struct ice_pf *pf);
|
2018-09-20 08:42:55 +08:00
|
|
|
int ice_sriov_configure(struct pci_dev *pdev, int num_vfs);
|
2018-09-20 08:42:58 +08:00
|
|
|
int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
|
2019-02-27 08:35:11 +08:00
|
|
|
int
|
|
|
|
ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi);
|
2018-09-20 08:42:58 +08:00
|
|
|
|
2018-09-20 08:42:55 +08:00
|
|
|
void ice_free_vfs(struct ice_pf *pf);
|
2018-09-20 08:42:59 +08:00
|
|
|
void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event);
|
2018-09-20 08:43:00 +08:00
|
|
|
void ice_vc_notify_link_state(struct ice_pf *pf);
|
2018-09-20 08:42:57 +08:00
|
|
|
void ice_vc_notify_reset(struct ice_pf *pf);
|
2018-09-20 08:42:55 +08:00
|
|
|
bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr);
|
2020-02-14 05:31:16 +08:00
|
|
|
bool ice_reset_vf(struct ice_vf *vf, bool is_vflr);
|
2018-09-20 08:42:58 +08:00
|
|
|
|
2019-02-27 08:35:11 +08:00
|
|
|
int
|
|
|
|
ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
|
|
|
|
__be16 vlan_proto);
|
2018-09-20 08:42:58 +08:00
|
|
|
|
|
|
|
int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted);
|
|
|
|
|
|
|
|
int ice_set_vf_link_state(struct net_device *netdev, int vf_id, int link_state);
|
|
|
|
|
|
|
|
int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena);
|
ice: Refactor interrupt tracking
Currently we have two MSI-x (IRQ) trackers, one for OS requested MSI-x
entries (sw_irq_tracker) and one for hardware MSI-x vectors
(hw_irq_tracker). Generally the sw_irq_tracker has less entries than the
hw_irq_tracker because the hw_irq_tracker has entries equal to the max
allowed MSI-x per PF and the sw_irq_tracker is mainly the minimum (non
SR-IOV portion of the vectors, kernel granted IRQs). All of the non
SR-IOV portions of the driver (i.e. LAN queues, RDMA queues, OICR, etc.)
take at least one of each type of tracker resource. SR-IOV only grabs
entries from the hw_irq_tracker. There are a few issues with this approach
that can be seen when doing any kind of device reconfiguration (i.e.
ethtool -L, SR-IOV, etc.). One of them being, any time the driver creates
an ice_q_vector and associates it to a LAN queue pair it will grab and
use one entry from the hw_irq_tracker and one from the sw_irq_tracker.
If the indices on these does not match it will cause a Tx timeout, which
will cause a reset and then the indices will match up again and traffic
will resume. The mismatched indices come from the trackers not being the
same size and/or the search_hint in the two trackers not being equal.
Another reason for the refactor is the co-existence of features with
SR-IOV. If SR-IOV is enabled and the interrupts are taken from the end
of the sw_irq_tracker then other features can no longer use this space
because the hardware has now given the remaining interrupts to SR-IOV.
This patch reworks how we track MSI-x vectors by removing the
hw_irq_tracker completely and instead MSI-x resources needed for SR-IOV
are determined all at once instead of per VF. This can be done because
when creating VFs we know how many are wanted and how many MSI-x vectors
each VF needs. This also allows us to start using MSI-x resources from
the end of the PF's allowed MSI-x vectors so we are less likely to use
entries needed for other features (i.e. RDMA, L2 Offload, etc).
This patch also reworks the ice_res_tracker structure by removing the
search_hint and adding a new member - "end". Instead of having a
search_hint we will always search from 0. The new member, "end", will be
used to manipulate the end of the ice_res_tracker (specifically
sw_irq_tracker) during runtime based on MSI-x vectors needed by SR-IOV.
In the normal case, the end of ice_res_tracker will be equal to the
ice_res_tracker's num_entries.
The sriov_base_vector member was added to the PF structure. It is used
to represent the starting MSI-x index of all the needed MSI-x vectors
for all SR-IOV VFs. Depending on how many MSI-x are needed, SR-IOV may
have to take resources from the sw_irq_tracker. This is done by setting
the sw_irq_tracker->end equal to the pf->sriov_base_vector. When all
SR-IOV VFs are removed then the sw_irq_tracker->end is reset back to
sw_irq_tracker->num_entries. The sriov_base_vector, along with the VF's
number of MSI-x (pf->num_vf_msix), vf_id, and the base MSI-x index on
the PF (pf->hw.func_caps.common_cap.msix_vector_first_id), is used to
calculate the first HW absolute MSI-x index for each VF, which is used
to write to the VPINT_ALLOC[_PCI] and GLINT_VECT2FUNC registers to
program the VFs MSI-x PCI configuration bits. Also, the sriov_base_vector
is used along with VF's num_vf_msix, vf_id, and q_vector->v_idx to
determine the MSI-x register index (used for writing to GLINT_DYN_CTL)
within the PF's space.
Interrupt changes removed any references to hw_base_vector, hw_oicr_idx,
and hw_irq_tracker. Only sw_base_vector, sw_oicr_idx, and sw_irq_tracker
variables remain. Change all of these by removing the "sw_" prefix to
help avoid confusion with these variables and their use.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
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>
2019-04-17 01:30:44 +08:00
|
|
|
|
|
|
|
int ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector);
|
2019-08-02 16:25:20 +08:00
|
|
|
|
|
|
|
void ice_set_vf_state_qs_dis(struct ice_vf *vf);
|
2019-11-08 22:23:28 +08:00
|
|
|
int
|
|
|
|
ice_get_vf_stats(struct net_device *netdev, int vf_id,
|
|
|
|
struct ifla_vf_stats *vf_stats);
|
2020-01-22 23:21:31 +08:00
|
|
|
void
|
|
|
|
ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event);
|
2020-02-14 05:31:16 +08:00
|
|
|
void ice_print_vfs_mdd_events(struct ice_pf *pf);
|
2018-09-20 08:42:55 +08:00
|
|
|
#else /* CONFIG_PCI_IOV */
|
2018-09-20 08:42:57 +08:00
|
|
|
#define ice_process_vflr_event(pf) do {} while (0)
|
2018-09-20 08:42:55 +08:00
|
|
|
#define ice_free_vfs(pf) do {} while (0)
|
2018-09-20 08:42:59 +08:00
|
|
|
#define ice_vc_process_vf_msg(pf, event) do {} while (0)
|
2018-09-20 08:43:00 +08:00
|
|
|
#define ice_vc_notify_link_state(pf) do {} while (0)
|
2018-09-20 08:42:57 +08:00
|
|
|
#define ice_vc_notify_reset(pf) do {} while (0)
|
2019-08-02 16:25:20 +08:00
|
|
|
#define ice_set_vf_state_qs_dis(vf) do {} while (0)
|
2020-01-22 23:21:31 +08:00
|
|
|
#define ice_vf_lan_overflow_event(pf, event) do {} while (0)
|
2020-02-14 05:31:16 +08:00
|
|
|
#define ice_print_vfs_mdd_events(pf) do {} while (0)
|
2018-09-20 08:43:00 +08:00
|
|
|
|
2018-09-20 08:42:55 +08:00
|
|
|
static inline bool
|
|
|
|
ice_reset_all_vfs(struct ice_pf __always_unused *pf,
|
|
|
|
bool __always_unused is_vflr)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-02-14 05:31:16 +08:00
|
|
|
static inline bool
|
|
|
|
ice_reset_vf(struct ice_vf __always_unused *vf, bool __always_unused is_vflr)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-09-20 08:42:55 +08:00
|
|
|
static inline int
|
|
|
|
ice_sriov_configure(struct pci_dev __always_unused *pdev,
|
|
|
|
int __always_unused num_vfs)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
2018-09-20 08:42:58 +08:00
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_set_vf_mac(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id, u8 __always_unused *mac)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_get_vf_cfg(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id,
|
|
|
|
struct ifla_vf_info __always_unused *ivi)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_set_vf_trust(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id, bool __always_unused trusted)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_set_vf_port_vlan(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id, u16 __always_unused vid,
|
|
|
|
u8 __always_unused qos, __be16 __always_unused v_proto)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_set_vf_spoofchk(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id, bool __always_unused ena)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_set_vf_link_state(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id, int __always_unused link_state)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
ice: Refactor interrupt tracking
Currently we have two MSI-x (IRQ) trackers, one for OS requested MSI-x
entries (sw_irq_tracker) and one for hardware MSI-x vectors
(hw_irq_tracker). Generally the sw_irq_tracker has less entries than the
hw_irq_tracker because the hw_irq_tracker has entries equal to the max
allowed MSI-x per PF and the sw_irq_tracker is mainly the minimum (non
SR-IOV portion of the vectors, kernel granted IRQs). All of the non
SR-IOV portions of the driver (i.e. LAN queues, RDMA queues, OICR, etc.)
take at least one of each type of tracker resource. SR-IOV only grabs
entries from the hw_irq_tracker. There are a few issues with this approach
that can be seen when doing any kind of device reconfiguration (i.e.
ethtool -L, SR-IOV, etc.). One of them being, any time the driver creates
an ice_q_vector and associates it to a LAN queue pair it will grab and
use one entry from the hw_irq_tracker and one from the sw_irq_tracker.
If the indices on these does not match it will cause a Tx timeout, which
will cause a reset and then the indices will match up again and traffic
will resume. The mismatched indices come from the trackers not being the
same size and/or the search_hint in the two trackers not being equal.
Another reason for the refactor is the co-existence of features with
SR-IOV. If SR-IOV is enabled and the interrupts are taken from the end
of the sw_irq_tracker then other features can no longer use this space
because the hardware has now given the remaining interrupts to SR-IOV.
This patch reworks how we track MSI-x vectors by removing the
hw_irq_tracker completely and instead MSI-x resources needed for SR-IOV
are determined all at once instead of per VF. This can be done because
when creating VFs we know how many are wanted and how many MSI-x vectors
each VF needs. This also allows us to start using MSI-x resources from
the end of the PF's allowed MSI-x vectors so we are less likely to use
entries needed for other features (i.e. RDMA, L2 Offload, etc).
This patch also reworks the ice_res_tracker structure by removing the
search_hint and adding a new member - "end". Instead of having a
search_hint we will always search from 0. The new member, "end", will be
used to manipulate the end of the ice_res_tracker (specifically
sw_irq_tracker) during runtime based on MSI-x vectors needed by SR-IOV.
In the normal case, the end of ice_res_tracker will be equal to the
ice_res_tracker's num_entries.
The sriov_base_vector member was added to the PF structure. It is used
to represent the starting MSI-x index of all the needed MSI-x vectors
for all SR-IOV VFs. Depending on how many MSI-x are needed, SR-IOV may
have to take resources from the sw_irq_tracker. This is done by setting
the sw_irq_tracker->end equal to the pf->sriov_base_vector. When all
SR-IOV VFs are removed then the sw_irq_tracker->end is reset back to
sw_irq_tracker->num_entries. The sriov_base_vector, along with the VF's
number of MSI-x (pf->num_vf_msix), vf_id, and the base MSI-x index on
the PF (pf->hw.func_caps.common_cap.msix_vector_first_id), is used to
calculate the first HW absolute MSI-x index for each VF, which is used
to write to the VPINT_ALLOC[_PCI] and GLINT_VECT2FUNC registers to
program the VFs MSI-x PCI configuration bits. Also, the sriov_base_vector
is used along with VF's num_vf_msix, vf_id, and q_vector->v_idx to
determine the MSI-x register index (used for writing to GLINT_DYN_CTL)
within the PF's space.
Interrupt changes removed any references to hw_base_vector, hw_oicr_idx,
and hw_irq_tracker. Only sw_base_vector, sw_oicr_idx, and sw_irq_tracker
variables remain. Change all of these by removing the "sw_" prefix to
help avoid confusion with these variables and their use.
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
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>
2019-04-17 01:30:44 +08:00
|
|
|
static inline int
|
|
|
|
ice_calc_vf_reg_idx(struct ice_vf __always_unused *vf,
|
|
|
|
struct ice_q_vector __always_unused *q_vector)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2019-11-08 22:23:28 +08:00
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_get_vf_stats(struct net_device __always_unused *netdev,
|
|
|
|
int __always_unused vf_id,
|
|
|
|
struct ifla_vf_stats __always_unused *vf_stats)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
2018-09-20 08:42:55 +08:00
|
|
|
#endif /* CONFIG_PCI_IOV */
|
|
|
|
#endif /* _ICE_VIRTCHNL_PF_H_ */
|