2016-05-11 21:36:12 +08:00
|
|
|
/* QLogic qed NIC Driver
|
2017-01-01 19:57:00 +08:00
|
|
|
* Copyright (c) 2015-2017 QLogic Corporation
|
2016-05-11 21:36:12 +08:00
|
|
|
*
|
2017-01-01 19:57:00 +08:00
|
|
|
* This software is available to you under a choice of one of two
|
|
|
|
* licenses. You may choose to be licensed under the terms of the GNU
|
|
|
|
* General Public License (GPL) Version 2, available from the file
|
|
|
|
* COPYING in the main directory of this source tree, or the
|
|
|
|
* OpenIB.org BSD license below:
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or
|
|
|
|
* without modification, are permitted provided that the following
|
|
|
|
* conditions are met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer.
|
|
|
|
*
|
|
|
|
* - Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and /or other materials
|
|
|
|
* provided with the distribution.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2016-05-11 21:36:12 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _QED_SRIOV_H
|
|
|
|
#define _QED_SRIOV_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include "qed_vf.h"
|
2016-06-05 18:11:12 +08:00
|
|
|
|
|
|
|
#define QED_ETH_VF_NUM_MAC_FILTERS 1
|
|
|
|
#define QED_ETH_VF_NUM_VLAN_FILTERS 2
|
2016-05-11 21:36:12 +08:00
|
|
|
#define QED_VF_ARRAY_LENGTH (3)
|
|
|
|
|
2016-06-01 21:29:13 +08:00
|
|
|
#ifdef CONFIG_QED_SRIOV
|
2016-05-11 21:36:12 +08:00
|
|
|
#define IS_VF(cdev) ((cdev)->b_is_vf)
|
|
|
|
#define IS_PF(cdev) (!((cdev)->b_is_vf))
|
|
|
|
#define IS_PF_SRIOV(p_hwfn) (!!((p_hwfn)->cdev->p_iov_info))
|
|
|
|
#else
|
2016-06-01 21:29:13 +08:00
|
|
|
#define IS_VF(cdev) (0)
|
|
|
|
#define IS_PF(cdev) (1)
|
2016-05-11 21:36:12 +08:00
|
|
|
#define IS_PF_SRIOV(p_hwfn) (0)
|
|
|
|
#endif
|
|
|
|
#define IS_PF_SRIOV_ALLOC(p_hwfn) (!!((p_hwfn)->pf_iov_info))
|
|
|
|
|
2016-05-11 21:36:14 +08:00
|
|
|
#define QED_MAX_VF_CHAINS_PER_PF 16
|
|
|
|
|
2016-05-11 21:36:20 +08:00
|
|
|
#define QED_ETH_MAX_VF_NUM_VLAN_FILTERS \
|
|
|
|
(MAX_NUM_VFS * QED_ETH_VF_NUM_VLAN_FILTERS)
|
|
|
|
|
2016-05-11 21:36:16 +08:00
|
|
|
enum qed_iov_vport_update_flag {
|
|
|
|
QED_IOV_VP_UPDATE_ACTIVATE,
|
2016-05-11 21:36:18 +08:00
|
|
|
QED_IOV_VP_UPDATE_VLAN_STRIP,
|
|
|
|
QED_IOV_VP_UPDATE_TX_SWITCH,
|
2016-05-11 21:36:16 +08:00
|
|
|
QED_IOV_VP_UPDATE_MCAST,
|
|
|
|
QED_IOV_VP_UPDATE_ACCEPT_PARAM,
|
|
|
|
QED_IOV_VP_UPDATE_RSS,
|
2016-05-11 21:36:18 +08:00
|
|
|
QED_IOV_VP_UPDATE_ACCEPT_ANY_VLAN,
|
|
|
|
QED_IOV_VP_UPDATE_SGE_TPA,
|
2016-05-11 21:36:16 +08:00
|
|
|
QED_IOV_VP_UPDATE_MAX,
|
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:15 +08:00
|
|
|
struct qed_public_vf_info {
|
|
|
|
/* These copies will later be reflected in the bulletin board,
|
|
|
|
* but this copy should be newer.
|
|
|
|
*/
|
2016-05-11 21:36:21 +08:00
|
|
|
u8 forced_mac[ETH_ALEN];
|
2016-05-11 21:36:20 +08:00
|
|
|
u16 forced_vlan;
|
2016-05-11 21:36:15 +08:00
|
|
|
u8 mac[ETH_ALEN];
|
2016-05-11 21:36:22 +08:00
|
|
|
|
|
|
|
/* IFLA_VF_LINK_STATE_<X> */
|
|
|
|
int link_state;
|
|
|
|
|
|
|
|
/* Currently configured Tx rate in MB/sec. 0 if unconfigured */
|
|
|
|
int tx_rate;
|
2017-01-01 19:57:08 +08:00
|
|
|
|
|
|
|
/* Trusted VFs can configure promiscuous mode.
|
|
|
|
* Also store shadow promisc configuration if needed.
|
|
|
|
*/
|
|
|
|
bool is_trusted_configured;
|
|
|
|
bool is_trusted_request;
|
|
|
|
u8 rx_accept_mode;
|
|
|
|
u8 tx_accept_mode;
|
2016-05-11 21:36:15 +08:00
|
|
|
};
|
|
|
|
|
qed*: Handle-based L2-queues.
The driver needs to maintain several FW/HW-indices for each one of
its queues. Currently, that mapping is done by the QED where it uses
an rx/tx array of so-called hw-cids, populating them whenever a new
queue is opened and clearing them upon destruction of said queues.
This maintenance is far from ideal - there's no real reason why
QED needs to maintain such a data-structure. It becomes even worse
when considering the fact that the PF's queues and its child VFs' queues
are all mapped into the same data-structure.
As a by-product, the set of parameters an interface needs to supply for
queue APIs is non-trivial, and some of the variables in the API
structures have different meaning depending on their exact place
in the configuration flow.
This patch re-organizes the way L2 queues are configured and maintained.
In short:
- Required parameters for queue init are now well-defined.
- Qed would allocate a queue-cid based on parameters.
Upon initialization success, it would return a handle to caller.
- Queue-handle would be maintained by entity requesting queue-init,
not necessarily qed.
- All further queue-APIs [update, destroy] would use the opaque
handle as reference for the queue instead of various indices.
The possible owners of such handles:
- PF queues [qede] - complete handles based on provided configuration.
- VF queues [qede] - fw-context-less handles, containing only relative
information; Only the PF-side would need the absolute indices
for configuration, so they're omitted here.
- VF queues [qed, PF-side] - complete handles based on VF initialization.
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-29 22:47:06 +08:00
|
|
|
struct qed_iov_vf_init_params {
|
|
|
|
u16 rel_vf_id;
|
|
|
|
|
|
|
|
/* Number of requested Queues; Currently, don't support different
|
|
|
|
* number of Rx/Tx queues.
|
|
|
|
*/
|
|
|
|
|
|
|
|
u16 num_queues;
|
|
|
|
|
|
|
|
/* Allow the client to choose which qzones to use for Rx/Tx,
|
|
|
|
* and which queue_base to use for Tx queues on a per-queue basis.
|
|
|
|
* Notice values should be relative to the PF resources.
|
|
|
|
*/
|
|
|
|
u16 req_rx_queue[QED_MAX_VF_CHAINS_PER_PF];
|
|
|
|
u16 req_tx_queue[QED_MAX_VF_CHAINS_PER_PF];
|
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
/* This struct is part of qed_dev and contains data relevant to all hwfns;
|
|
|
|
* Initialized only if SR-IOV cpabability is exposed in PCIe config space.
|
|
|
|
*/
|
|
|
|
struct qed_hw_sriov_info {
|
|
|
|
int pos; /* capability position */
|
|
|
|
int nres; /* number of resources */
|
|
|
|
u32 cap; /* SR-IOV Capabilities */
|
|
|
|
u16 ctrl; /* SR-IOV Control */
|
|
|
|
u16 total_vfs; /* total VFs associated with the PF */
|
|
|
|
u16 num_vfs; /* number of vfs that have been started */
|
|
|
|
u16 initial_vfs; /* initial VFs associated with the PF */
|
|
|
|
u16 nr_virtfn; /* number of VFs available */
|
|
|
|
u16 offset; /* first VF Routing ID offset */
|
|
|
|
u16 stride; /* following VF stride */
|
|
|
|
u16 vf_device_id; /* VF device id */
|
|
|
|
u32 pgsz; /* page size for BAR alignment */
|
|
|
|
u8 link; /* Function Dependency Link */
|
|
|
|
|
|
|
|
u32 first_vf_in_pf;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This mailbox is maintained per VF in its PF contains all information
|
|
|
|
* required for sending / receiving a message.
|
|
|
|
*/
|
|
|
|
struct qed_iov_vf_mbx {
|
|
|
|
union vfpf_tlvs *req_virt;
|
|
|
|
dma_addr_t req_phys;
|
|
|
|
union pfvf_tlvs *reply_virt;
|
|
|
|
dma_addr_t reply_phys;
|
2016-05-11 21:36:13 +08:00
|
|
|
|
|
|
|
/* Address in VF where a pending message is located */
|
|
|
|
dma_addr_t pending_req;
|
|
|
|
|
2017-02-27 17:06:32 +08:00
|
|
|
/* Message from VF awaits handling */
|
|
|
|
bool b_pending_msg;
|
|
|
|
|
2016-05-11 21:36:13 +08:00
|
|
|
u8 *offset;
|
|
|
|
|
|
|
|
/* saved VF request header */
|
|
|
|
struct vfpf_first_tlv first_tlv;
|
2016-05-11 21:36:12 +08:00
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:14 +08:00
|
|
|
struct qed_vf_q_info {
|
|
|
|
u16 fw_rx_qid;
|
qed*: Handle-based L2-queues.
The driver needs to maintain several FW/HW-indices for each one of
its queues. Currently, that mapping is done by the QED where it uses
an rx/tx array of so-called hw-cids, populating them whenever a new
queue is opened and clearing them upon destruction of said queues.
This maintenance is far from ideal - there's no real reason why
QED needs to maintain such a data-structure. It becomes even worse
when considering the fact that the PF's queues and its child VFs' queues
are all mapped into the same data-structure.
As a by-product, the set of parameters an interface needs to supply for
queue APIs is non-trivial, and some of the variables in the API
structures have different meaning depending on their exact place
in the configuration flow.
This patch re-organizes the way L2 queues are configured and maintained.
In short:
- Required parameters for queue init are now well-defined.
- Qed would allocate a queue-cid based on parameters.
Upon initialization success, it would return a handle to caller.
- Queue-handle would be maintained by entity requesting queue-init,
not necessarily qed.
- All further queue-APIs [update, destroy] would use the opaque
handle as reference for the queue instead of various indices.
The possible owners of such handles:
- PF queues [qede] - complete handles based on provided configuration.
- VF queues [qede] - fw-context-less handles, containing only relative
information; Only the PF-side would need the absolute indices
for configuration, so they're omitted here.
- VF queues [qed, PF-side] - complete handles based on VF initialization.
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-29 22:47:06 +08:00
|
|
|
struct qed_queue_cid *p_rx_cid;
|
2016-05-11 21:36:14 +08:00
|
|
|
u16 fw_tx_qid;
|
qed*: Handle-based L2-queues.
The driver needs to maintain several FW/HW-indices for each one of
its queues. Currently, that mapping is done by the QED where it uses
an rx/tx array of so-called hw-cids, populating them whenever a new
queue is opened and clearing them upon destruction of said queues.
This maintenance is far from ideal - there's no real reason why
QED needs to maintain such a data-structure. It becomes even worse
when considering the fact that the PF's queues and its child VFs' queues
are all mapped into the same data-structure.
As a by-product, the set of parameters an interface needs to supply for
queue APIs is non-trivial, and some of the variables in the API
structures have different meaning depending on their exact place
in the configuration flow.
This patch re-organizes the way L2 queues are configured and maintained.
In short:
- Required parameters for queue init are now well-defined.
- Qed would allocate a queue-cid based on parameters.
Upon initialization success, it would return a handle to caller.
- Queue-handle would be maintained by entity requesting queue-init,
not necessarily qed.
- All further queue-APIs [update, destroy] would use the opaque
handle as reference for the queue instead of various indices.
The possible owners of such handles:
- PF queues [qede] - complete handles based on provided configuration.
- VF queues [qede] - fw-context-less handles, containing only relative
information; Only the PF-side would need the absolute indices
for configuration, so they're omitted here.
- VF queues [qed, PF-side] - complete handles based on VF initialization.
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-29 22:47:06 +08:00
|
|
|
struct qed_queue_cid *p_tx_cid;
|
2016-05-11 21:36:14 +08:00
|
|
|
u8 fw_cid;
|
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
enum vf_state {
|
2016-05-11 21:36:14 +08:00
|
|
|
VF_FREE = 0, /* VF ready to be acquired holds no resc */
|
|
|
|
VF_ACQUIRED, /* VF, acquired, but not initalized */
|
2016-05-11 21:36:16 +08:00
|
|
|
VF_ENABLED, /* VF, Enabled */
|
2016-05-11 21:36:15 +08:00
|
|
|
VF_RESET, /* VF, FLR'd, pending cleanup */
|
2016-05-11 21:36:12 +08:00
|
|
|
VF_STOPPED /* VF, Stopped */
|
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:20 +08:00
|
|
|
struct qed_vf_vlan_shadow {
|
|
|
|
bool used;
|
|
|
|
u16 vid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct qed_vf_shadow_config {
|
|
|
|
/* Shadow copy of all guest vlans */
|
|
|
|
struct qed_vf_vlan_shadow vlans[QED_ETH_VF_NUM_VLAN_FILTERS + 1];
|
|
|
|
|
2016-06-05 18:11:15 +08:00
|
|
|
/* Shadow copy of all configured MACs; Empty if forcing MACs */
|
|
|
|
u8 macs[QED_ETH_VF_NUM_MAC_FILTERS][ETH_ALEN];
|
2016-05-11 21:36:20 +08:00
|
|
|
u8 inner_vlan_removal;
|
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
/* PFs maintain an array of this structure, per VF */
|
|
|
|
struct qed_vf_info {
|
|
|
|
struct qed_iov_vf_mbx vf_mbx;
|
|
|
|
enum vf_state state;
|
|
|
|
bool b_init;
|
2016-10-14 17:19:22 +08:00
|
|
|
bool b_malicious;
|
2016-05-11 21:36:15 +08:00
|
|
|
u8 to_disable;
|
2016-05-11 21:36:12 +08:00
|
|
|
|
|
|
|
struct qed_bulletin bulletin;
|
|
|
|
dma_addr_t vf_bulletin;
|
|
|
|
|
2016-06-05 18:11:11 +08:00
|
|
|
/* PF saves a copy of the last VF acquire message */
|
|
|
|
struct vfpf_acquire_tlv acquire;
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
u32 concrete_fid;
|
|
|
|
u16 opaque_fid;
|
2016-05-11 21:36:16 +08:00
|
|
|
u16 mtu;
|
2016-05-11 21:36:12 +08:00
|
|
|
|
|
|
|
u8 vport_id;
|
|
|
|
u8 relative_vf_id;
|
|
|
|
u8 abs_vf_id;
|
|
|
|
#define QED_VF_ABS_ID(p_hwfn, p_vf) (QED_PATH_ID(p_hwfn) ? \
|
|
|
|
(p_vf)->abs_vf_id + MAX_NUM_VFS_BB : \
|
|
|
|
(p_vf)->abs_vf_id)
|
2016-05-11 21:36:14 +08:00
|
|
|
|
2016-05-11 21:36:16 +08:00
|
|
|
u8 vport_instance;
|
2016-05-11 21:36:14 +08:00
|
|
|
u8 num_rxqs;
|
|
|
|
u8 num_txqs;
|
|
|
|
|
|
|
|
u8 num_sbs;
|
|
|
|
|
|
|
|
u8 num_mac_filters;
|
|
|
|
u8 num_vlan_filters;
|
|
|
|
struct qed_vf_q_info vf_queues[QED_MAX_VF_CHAINS_PER_PF];
|
|
|
|
u16 igu_sbs[QED_MAX_VF_CHAINS_PER_PF];
|
2016-05-11 21:36:16 +08:00
|
|
|
u8 num_active_rxqs;
|
2016-05-11 21:36:15 +08:00
|
|
|
struct qed_public_vf_info p_vf_info;
|
2016-05-11 21:36:23 +08:00
|
|
|
bool spoof_chk;
|
|
|
|
bool req_spoofchk_val;
|
2016-05-11 21:36:20 +08:00
|
|
|
|
|
|
|
/* Stores the configuration requested by VF */
|
|
|
|
struct qed_vf_shadow_config shadow_config;
|
|
|
|
|
|
|
|
/* A bitfield using bulletin's valid-map bits, used to indicate
|
|
|
|
* which of the bulletin board features have been configured.
|
|
|
|
*/
|
|
|
|
u64 configured_features;
|
|
|
|
#define QED_IOV_CONFIGURED_FEATURES_MASK ((1 << MAC_ADDR_FORCED) | \
|
|
|
|
(1 << VLAN_ADDR_FORCED))
|
2016-05-11 21:36:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This structure is part of qed_hwfn and used only for PFs that have sriov
|
|
|
|
* capability enabled.
|
|
|
|
*/
|
|
|
|
struct qed_pf_iov {
|
|
|
|
struct qed_vf_info vfs_array[MAX_NUM_VFS];
|
|
|
|
u64 pending_flr[QED_VF_ARRAY_LENGTH];
|
|
|
|
|
|
|
|
/* Allocate message address continuosuly and split to each VF */
|
|
|
|
void *mbx_msg_virt_addr;
|
|
|
|
dma_addr_t mbx_msg_phys_addr;
|
|
|
|
u32 mbx_msg_size;
|
|
|
|
void *mbx_reply_virt_addr;
|
|
|
|
dma_addr_t mbx_reply_phys_addr;
|
|
|
|
u32 mbx_reply_size;
|
|
|
|
void *p_bulletins;
|
|
|
|
dma_addr_t bulletins_phys;
|
|
|
|
u32 bulletins_size;
|
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:13 +08:00
|
|
|
enum qed_iov_wq_flag {
|
|
|
|
QED_IOV_WQ_MSG_FLAG,
|
|
|
|
QED_IOV_WQ_SET_UNICAST_FILTER_FLAG,
|
|
|
|
QED_IOV_WQ_BULLETIN_UPDATE_FLAG,
|
|
|
|
QED_IOV_WQ_STOP_WQ_FLAG,
|
|
|
|
QED_IOV_WQ_FLR_FLAG,
|
2017-01-01 19:57:08 +08:00
|
|
|
QED_IOV_WQ_TRUST_FLAG,
|
2017-02-21 04:43:39 +08:00
|
|
|
QED_IOV_WQ_VF_FORCE_LINK_QUERY_FLAG,
|
2016-05-11 21:36:13 +08:00
|
|
|
};
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
#ifdef CONFIG_QED_SRIOV
|
|
|
|
/**
|
|
|
|
* @brief - Given a VF index, return index of next [including that] active VF.
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param rel_vf_id
|
|
|
|
*
|
|
|
|
* @return MAX_NUM_VFS in case no further active VFs, otherwise index.
|
|
|
|
*/
|
|
|
|
u16 qed_iov_get_next_active_vf(struct qed_hwfn *p_hwfn, u16 rel_vf_id);
|
|
|
|
|
2017-04-25 01:00:48 +08:00
|
|
|
void qed_iov_bulletin_set_udp_ports(struct qed_hwfn *p_hwfn,
|
|
|
|
int vfid, u16 vxlan_port, u16 geneve_port);
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
/**
|
|
|
|
* @brief Read sriov related information and allocated resources
|
|
|
|
* reads from configuraiton space, shmem, etc.
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
int qed_iov_hw_info(struct qed_hwfn *p_hwfn);
|
|
|
|
|
2016-05-11 21:36:14 +08:00
|
|
|
/**
|
|
|
|
* @brief qed_add_tlv - place a given tlv on the tlv buffer at next offset
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param p_iov
|
|
|
|
* @param type
|
|
|
|
* @param length
|
|
|
|
*
|
|
|
|
* @return pointer to the newly placed tlv
|
|
|
|
*/
|
|
|
|
void *qed_add_tlv(struct qed_hwfn *p_hwfn, u8 **offset, u16 type, u16 length);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief list the types and lengths of the tlvs on the buffer
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param tlvs_list
|
|
|
|
*/
|
|
|
|
void qed_dp_tlv_list(struct qed_hwfn *p_hwfn, void *tlvs_list);
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
/**
|
|
|
|
* @brief qed_iov_alloc - allocate sriov related resources
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
int qed_iov_alloc(struct qed_hwfn *p_hwfn);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief qed_iov_setup - setup sriov related resources
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param p_ptt
|
|
|
|
*/
|
|
|
|
void qed_iov_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief qed_iov_free - free sriov related resources
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
*/
|
|
|
|
void qed_iov_free(struct qed_hwfn *p_hwfn);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief free sriov related memory that was allocated during hw_prepare
|
|
|
|
*
|
|
|
|
* @param cdev
|
|
|
|
*/
|
|
|
|
void qed_iov_free_hw_info(struct qed_dev *cdev);
|
2016-05-11 21:36:13 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief qed_sriov_eqe_event - handle async sriov event arrived on eqe.
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param opcode
|
|
|
|
* @param echo
|
|
|
|
* @param data
|
|
|
|
*/
|
|
|
|
int qed_sriov_eqe_event(struct qed_hwfn *p_hwfn,
|
|
|
|
u8 opcode, __le16 echo, union event_ring_data *data);
|
|
|
|
|
2016-05-11 21:36:15 +08:00
|
|
|
/**
|
|
|
|
* @brief Mark structs of vfs that have been FLR-ed.
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param disabled_vfs - bitmask of all VFs on path that were FLRed
|
|
|
|
*
|
2017-03-19 19:08:18 +08:00
|
|
|
* @return true iff one of the PF's vfs got FLRed. false otherwise.
|
2016-05-11 21:36:15 +08:00
|
|
|
*/
|
2017-03-19 19:08:18 +08:00
|
|
|
bool qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn, u32 *disabled_vfs);
|
2016-05-11 21:36:15 +08:00
|
|
|
|
2016-05-11 21:36:16 +08:00
|
|
|
/**
|
|
|
|
* @brief Search extended TLVs in request/reply buffer.
|
|
|
|
*
|
|
|
|
* @param p_hwfn
|
|
|
|
* @param p_tlvs_list - Pointer to tlvs list
|
|
|
|
* @param req_type - Type of TLV
|
|
|
|
*
|
|
|
|
* @return pointer to tlv type if found, otherwise returns NULL.
|
|
|
|
*/
|
|
|
|
void *qed_iov_search_list_tlvs(struct qed_hwfn *p_hwfn,
|
|
|
|
void *p_tlvs_list, u16 req_type);
|
|
|
|
|
2016-05-11 21:36:13 +08:00
|
|
|
void qed_iov_wq_stop(struct qed_dev *cdev, bool schedule_first);
|
|
|
|
int qed_iov_wq_start(struct qed_dev *cdev);
|
|
|
|
|
|
|
|
void qed_schedule_iov(struct qed_hwfn *hwfn, enum qed_iov_wq_flag flag);
|
2016-05-11 21:36:14 +08:00
|
|
|
void qed_vf_start_iov_wq(struct qed_dev *cdev);
|
2016-05-11 21:36:15 +08:00
|
|
|
int qed_sriov_disable(struct qed_dev *cdev, bool pci_enabled);
|
2016-05-11 21:36:17 +08:00
|
|
|
void qed_inform_vf_link_state(struct qed_hwfn *hwfn);
|
2016-05-11 21:36:12 +08:00
|
|
|
#else
|
|
|
|
static inline u16 qed_iov_get_next_active_vf(struct qed_hwfn *p_hwfn,
|
|
|
|
u16 rel_vf_id)
|
|
|
|
{
|
|
|
|
return MAX_NUM_VFS;
|
|
|
|
}
|
|
|
|
|
2017-04-25 01:00:48 +08:00
|
|
|
static inline void
|
|
|
|
qed_iov_bulletin_set_udp_ports(struct qed_hwfn *p_hwfn, int vfid,
|
|
|
|
u16 vxlan_port, u16 geneve_port)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-11 21:36:12 +08:00
|
|
|
static inline int qed_iov_hw_info(struct qed_hwfn *p_hwfn)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qed_iov_alloc(struct qed_hwfn *p_hwfn)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qed_iov_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qed_iov_free(struct qed_hwfn *p_hwfn)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qed_iov_free_hw_info(struct qed_dev *cdev)
|
|
|
|
{
|
|
|
|
}
|
2016-05-11 21:36:13 +08:00
|
|
|
|
|
|
|
static inline int qed_sriov_eqe_event(struct qed_hwfn *p_hwfn,
|
|
|
|
u8 opcode,
|
|
|
|
__le16 echo, union event_ring_data *data)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2017-03-19 19:08:18 +08:00
|
|
|
static inline bool qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn,
|
|
|
|
u32 *disabled_vfs)
|
2016-05-11 21:36:15 +08:00
|
|
|
{
|
2017-03-19 19:08:18 +08:00
|
|
|
return false;
|
2016-05-11 21:36:15 +08:00
|
|
|
}
|
|
|
|
|
2016-05-11 21:36:13 +08:00
|
|
|
static inline void qed_iov_wq_stop(struct qed_dev *cdev, bool schedule_first)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qed_iov_wq_start(struct qed_dev *cdev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qed_schedule_iov(struct qed_hwfn *hwfn,
|
|
|
|
enum qed_iov_wq_flag flag)
|
|
|
|
{
|
|
|
|
}
|
2016-05-11 21:36:14 +08:00
|
|
|
|
|
|
|
static inline void qed_vf_start_iov_wq(struct qed_dev *cdev)
|
|
|
|
{
|
|
|
|
}
|
2016-05-11 21:36:15 +08:00
|
|
|
|
|
|
|
static inline int qed_sriov_disable(struct qed_dev *cdev, bool pci_enabled)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2016-05-11 21:36:17 +08:00
|
|
|
|
|
|
|
static inline void qed_inform_vf_link_state(struct qed_hwfn *hwfn)
|
|
|
|
{
|
|
|
|
}
|
2016-05-11 21:36:12 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define qed_for_each_vf(_p_hwfn, _i) \
|
|
|
|
for (_i = qed_iov_get_next_active_vf(_p_hwfn, 0); \
|
|
|
|
_i < MAX_NUM_VFS; \
|
|
|
|
_i = qed_iov_get_next_active_vf(_p_hwfn, _i + 1))
|
|
|
|
|
|
|
|
#endif
|