Commit c2653865 authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

fm10k: Add support for SR-IOV to PF core files

This change adds a set of functions to fm10k_pf.c which allows for
configuring the VF via a set of standardized TLV messages.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 5cb8db4a
This diff is collapsed.
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "fm10k_common.h" #include "fm10k_common.h"
bool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort); bool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
u16 fm10k_queues_per_pool(struct fm10k_hw *hw);
u16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
enum fm10k_pf_tlv_msg_id_v1 { enum fm10k_pf_tlv_msg_id_v1 {
FM10K_PF_MSG_ID_TEST = 0x000, /* msg ID reserved */ FM10K_PF_MSG_ID_TEST = 0x000, /* msg ID reserved */
...@@ -122,5 +124,12 @@ extern const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[]; ...@@ -122,5 +124,12 @@ extern const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[];
FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_TIMESTAMP, \ FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_TIMESTAMP, \
fm10k_1588_timestamp_msg_attr, func) fm10k_1588_timestamp_msg_attr, func)
s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
struct fm10k_mbx_info *);
s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
struct fm10k_mbx_info *);
extern const struct fm10k_msg_data fm10k_iov_msg_data_pf[];
extern struct fm10k_info fm10k_pf_info; extern struct fm10k_info fm10k_pf_info;
#endif /* _FM10K_PF_H */ #endif /* _FM10K_PF_H */
...@@ -567,6 +567,62 @@ enum fm10k_xcast_modes { ...@@ -567,6 +567,62 @@ enum fm10k_xcast_modes {
FM10K_XCAST_MODE_DISABLE = 4 FM10K_XCAST_MODE_DISABLE = 4
}; };
#define FM10K_VF_TC_MAX 100000 /* 100,000 Mb/s aka 100Gb/s */
#define FM10K_VF_TC_MIN 1 /* 1 Mb/s is the slowest rate */
struct fm10k_vf_info {
/* mbx must be first field in struct unless all default IOV message
* handlers are redone as the assumption is that vf_info starts
* at the same offset as the mailbox
*/
struct fm10k_mbx_info mbx; /* PF side of VF mailbox */
int rate; /* Tx BW cap as defined by OS */
u16 glort; /* resource tag for this VF */
u16 sw_vid; /* Switch API assigned VLAN */
u16 pf_vid; /* PF assigned Default VLAN */
u8 mac[ETH_ALEN]; /* PF Default MAC address */
u8 vsi; /* VSI idenfifier */
u8 vf_idx; /* which VF this is */
u8 vf_flags; /* flags indicating what modes
* are supported for the port
*/
};
#define FM10K_VF_FLAG_ALLMULTI_CAPABLE ((u8)1 << FM10K_XCAST_MODE_ALLMULTI)
#define FM10K_VF_FLAG_MULTI_CAPABLE ((u8)1 << FM10K_XCAST_MODE_MULTI)
#define FM10K_VF_FLAG_PROMISC_CAPABLE ((u8)1 << FM10K_XCAST_MODE_PROMISC)
#define FM10K_VF_FLAG_NONE_CAPABLE ((u8)1 << FM10K_XCAST_MODE_NONE)
#define FM10K_VF_FLAG_CAPABLE(vf_info) ((vf_info)->vf_flags & (u8)0xF)
#define FM10K_VF_FLAG_ENABLED(vf_info) ((vf_info)->vf_flags >> 4)
#define FM10K_VF_FLAG_SET_MODE(mode) ((u8)0x10 << (mode))
#define FM10K_VF_FLAG_SET_MODE_NONE \
FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_NONE)
#define FM10K_VF_FLAG_MULTI_ENABLED \
(FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_ALLMULTI) | \
FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_MULTI) | \
FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_PROMISC))
struct fm10k_iov_ops {
/* IOV related bring-up and tear-down */
s32 (*assign_resources)(struct fm10k_hw *, u16, u16);
s32 (*configure_tc)(struct fm10k_hw *, u16, int);
s32 (*assign_int_moderator)(struct fm10k_hw *, u16);
s32 (*assign_default_mac_vlan)(struct fm10k_hw *,
struct fm10k_vf_info *);
s32 (*reset_resources)(struct fm10k_hw *,
struct fm10k_vf_info *);
s32 (*set_lport)(struct fm10k_hw *, struct fm10k_vf_info *, u16, u8);
void (*reset_lport)(struct fm10k_hw *, struct fm10k_vf_info *);
void (*update_stats)(struct fm10k_hw *, struct fm10k_hw_stats_q *, u16);
};
struct fm10k_iov_info {
struct fm10k_iov_ops ops;
u16 total_vfs;
u16 num_vfs;
u16 num_pools;
};
enum fm10k_devices { enum fm10k_devices {
fm10k_device_pf, fm10k_device_pf,
fm10k_device_vf, fm10k_device_vf,
...@@ -576,6 +632,7 @@ struct fm10k_info { ...@@ -576,6 +632,7 @@ struct fm10k_info {
enum fm10k_mac_type mac; enum fm10k_mac_type mac;
s32 (*get_invariants)(struct fm10k_hw *); s32 (*get_invariants)(struct fm10k_hw *);
struct fm10k_mac_ops *mac_ops; struct fm10k_mac_ops *mac_ops;
struct fm10k_iov_ops *iov_ops;
}; };
struct fm10k_hw { struct fm10k_hw {
...@@ -584,6 +641,7 @@ struct fm10k_hw { ...@@ -584,6 +641,7 @@ struct fm10k_hw {
struct fm10k_mac_info mac; struct fm10k_mac_info mac;
struct fm10k_bus_info bus; struct fm10k_bus_info bus;
struct fm10k_bus_info bus_caps; struct fm10k_bus_info bus_caps;
struct fm10k_iov_info iov;
struct fm10k_mbx_info mbx; struct fm10k_mbx_info mbx;
struct fm10k_swapi_info swapi; struct fm10k_swapi_info swapi;
u16 device_id; u16 device_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment