Commit 071d08af authored by David S. Miller's avatar David S. Miller

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2019-03-22

This series contains updates to ice driver only.

Akeem enables MAC anti-spoofing by default when a new VSI is being
created.  Fixes an issue when reclaiming VF resources back to the pool
after reset, by freeing VF resources separately using the first VF
vector index to traverse the list, instead of starting at the last
assigned vectors list.  Added support for VF & PF promiscuous mode in
the ice driver.  Fixed the PF driver from letting the VF know it is "not
trusted" when it attempts to add more than its permitted additional MAC
addresses.  Altered how the driver gets the VF VSIs instances, instead
of using the mailbox messages to retrieve VSIs, get it directly via the
VF object in the PF data structure.

Bruce fixes return values to resolve static analysis warnings.  Made
whitespace changes to increase readability and reduce code wrapping.

Anirudh cleans up code by removing a function prototype that was never
implemented and removed an unused field in the ice_sched_vsi_info
structure.

Kiran fixes a potential divide by zero issue by adding a check.

Victor cleans up the transmit scheduler by adjusting the stack variable
usage and added/modified debug prints to make them more useful.

Yashaswini updates the driver in VEB mode to ensure that the LAN_EN bit
is set if all the right conditions are met.

Christopher ensures the loopback enable bit is not set for prune switch
rules, since all transmit traffic would be looped back to the internal
switch and dropped.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents bdaba895 f1ef73f5
...@@ -125,6 +125,23 @@ extern const char ice_drv_ver[]; ...@@ -125,6 +125,23 @@ extern const char ice_drv_ver[];
#define ice_for_each_q_vector(vsi, i) \ #define ice_for_each_q_vector(vsi, i) \
for ((i) = 0; (i) < (vsi)->num_q_vectors; (i)++) for ((i) = 0; (i) < (vsi)->num_q_vectors; (i)++)
#define ICE_UCAST_PROMISC_BITS (ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX | \
ICE_PROMISC_UCAST_RX | ICE_PROMISC_MCAST_RX)
#define ICE_UCAST_VLAN_PROMISC_BITS (ICE_PROMISC_UCAST_TX | \
ICE_PROMISC_MCAST_TX | \
ICE_PROMISC_UCAST_RX | \
ICE_PROMISC_MCAST_RX | \
ICE_PROMISC_VLAN_TX | \
ICE_PROMISC_VLAN_RX)
#define ICE_MCAST_PROMISC_BITS (ICE_PROMISC_MCAST_TX | ICE_PROMISC_MCAST_RX)
#define ICE_MCAST_VLAN_PROMISC_BITS (ICE_PROMISC_MCAST_TX | \
ICE_PROMISC_MCAST_RX | \
ICE_PROMISC_VLAN_TX | \
ICE_PROMISC_VLAN_RX)
struct ice_tc_info { struct ice_tc_info {
u16 qoffset; u16 qoffset;
u16 qcount_tx; u16 qcount_tx;
...@@ -258,6 +275,7 @@ struct ice_vsi { ...@@ -258,6 +275,7 @@ struct ice_vsi {
u8 irqs_ready; u8 irqs_ready;
u8 current_isup; /* Sync 'link up' logging */ u8 current_isup; /* Sync 'link up' logging */
u8 stat_offsets_loaded; u8 stat_offsets_loaded;
u8 vlan_ena;
/* queue information */ /* queue information */
u8 tx_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */ u8 tx_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */
...@@ -367,8 +385,9 @@ struct ice_netdev_priv { ...@@ -367,8 +385,9 @@ struct ice_netdev_priv {
* @vsi: pointer to vsi struct, can be NULL * @vsi: pointer to vsi struct, can be NULL
* @q_vector: pointer to q_vector, can be NULL * @q_vector: pointer to q_vector, can be NULL
*/ */
static inline void ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, static inline void
struct ice_q_vector *q_vector) ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi,
struct ice_q_vector *q_vector)
{ {
u32 vector = (vsi && q_vector) ? vsi->hw_base_vector + q_vector->v_idx : u32 vector = (vsi && q_vector) ? vsi->hw_base_vector + q_vector->v_idx :
((struct ice_pf *)hw->back)->hw_oicr_idx; ((struct ice_pf *)hw->back)->hw_oicr_idx;
......
...@@ -331,7 +331,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, ...@@ -331,7 +331,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
/* flag cleared so calling functions don't call AQ again */ /* flag cleared so calling functions don't call AQ again */
pi->phy.get_link_info = false; pi->phy.get_link_info = false;
return status; return 0;
} }
/** /**
...@@ -1100,8 +1100,9 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = { ...@@ -1100,8 +1100,9 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {
* *
* Dumps debug log about control command with descriptor contents. * Dumps debug log about control command with descriptor contents.
*/ */
void ice_debug_cq(struct ice_hw *hw, u32 __maybe_unused mask, void *desc, void
void *buf, u16 buf_len) ice_debug_cq(struct ice_hw *hw, u32 __maybe_unused mask, void *desc, void *buf,
u16 buf_len)
{ {
struct ice_aq_desc *cq_desc = (struct ice_aq_desc *)desc; struct ice_aq_desc *cq_desc = (struct ice_aq_desc *)desc;
u16 len; u16 len;
...@@ -1620,8 +1621,8 @@ ice_aq_discover_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count, ...@@ -1620,8 +1621,8 @@ ice_aq_discover_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
* @opc: capabilities type to discover - pass in the command opcode * @opc: capabilities type to discover - pass in the command opcode
*/ */
static enum ice_status ice_discover_caps(struct ice_hw *hw, static enum ice_status
enum ice_adminq_opc opc) ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc)
{ {
enum ice_status status; enum ice_status status;
u32 cap_count; u32 cap_count;
...@@ -2548,8 +2549,8 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps, ...@@ -2548,8 +2549,8 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps,
* @dest_ctx: the context to be written to * @dest_ctx: the context to be written to
* @ce_info: a description of the struct to be filled * @ce_info: a description of the struct to be filled
*/ */
static void ice_write_byte(u8 *src_ctx, u8 *dest_ctx, static void
const struct ice_ctx_ele *ce_info) ice_write_byte(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
{ {
u8 src_byte, dest_byte, mask; u8 src_byte, dest_byte, mask;
u8 *from, *dest; u8 *from, *dest;
...@@ -2587,8 +2588,8 @@ static void ice_write_byte(u8 *src_ctx, u8 *dest_ctx, ...@@ -2587,8 +2588,8 @@ static void ice_write_byte(u8 *src_ctx, u8 *dest_ctx,
* @dest_ctx: the context to be written to * @dest_ctx: the context to be written to
* @ce_info: a description of the struct to be filled * @ce_info: a description of the struct to be filled
*/ */
static void ice_write_word(u8 *src_ctx, u8 *dest_ctx, static void
const struct ice_ctx_ele *ce_info) ice_write_word(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
{ {
u16 src_word, mask; u16 src_word, mask;
__le16 dest_word; __le16 dest_word;
...@@ -2630,8 +2631,8 @@ static void ice_write_word(u8 *src_ctx, u8 *dest_ctx, ...@@ -2630,8 +2631,8 @@ static void ice_write_word(u8 *src_ctx, u8 *dest_ctx,
* @dest_ctx: the context to be written to * @dest_ctx: the context to be written to
* @ce_info: a description of the struct to be filled * @ce_info: a description of the struct to be filled
*/ */
static void ice_write_dword(u8 *src_ctx, u8 *dest_ctx, static void
const struct ice_ctx_ele *ce_info) ice_write_dword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
{ {
u32 src_dword, mask; u32 src_dword, mask;
__le32 dest_dword; __le32 dest_dword;
...@@ -2681,8 +2682,8 @@ static void ice_write_dword(u8 *src_ctx, u8 *dest_ctx, ...@@ -2681,8 +2682,8 @@ static void ice_write_dword(u8 *src_ctx, u8 *dest_ctx,
* @dest_ctx: the context to be written to * @dest_ctx: the context to be written to
* @ce_info: a description of the struct to be filled * @ce_info: a description of the struct to be filled
*/ */
static void ice_write_qword(u8 *src_ctx, u8 *dest_ctx, static void
const struct ice_ctx_ele *ce_info) ice_write_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
{ {
u64 src_qword, mask; u64 src_qword, mask;
__le64 dest_qword; __le64 dest_qword;
...@@ -3026,8 +3027,9 @@ void ice_replay_post(struct ice_hw *hw) ...@@ -3026,8 +3027,9 @@ void ice_replay_post(struct ice_hw *hw)
* @prev_stat: ptr to previous loaded stat value * @prev_stat: ptr to previous loaded stat value
* @cur_stat: ptr to current stat value * @cur_stat: ptr to current stat value
*/ */
void ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg, void
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat) ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat)
{ {
u64 new_data; u64 new_data;
...@@ -3057,8 +3059,9 @@ void ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg, ...@@ -3057,8 +3059,9 @@ void ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
* @prev_stat: ptr to previous loaded stat value * @prev_stat: ptr to previous loaded stat value
* @cur_stat: ptr to current stat value * @cur_stat: ptr to current stat value
*/ */
void ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded, void
u64 *prev_stat, u64 *cur_stat) ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
u64 *prev_stat, u64 *cur_stat)
{ {
u32 new_data; u32 new_data;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "ice_switch.h" #include "ice_switch.h"
#include <linux/avf/virtchnl.h> #include <linux/avf/virtchnl.h>
void ice_debug_cq(struct ice_hw *hw, u32 mask, void *desc, void *buf, void
u16 buf_len); ice_debug_cq(struct ice_hw *hw, u32 mask, void *desc, void *buf, u16 buf_len);
enum ice_status ice_init_hw(struct ice_hw *hw); enum ice_status ice_init_hw(struct ice_hw *hw);
void ice_deinit_hw(struct ice_hw *hw); void ice_deinit_hw(struct ice_hw *hw);
enum ice_status ice_check_reset(struct ice_hw *hw); enum ice_status ice_check_reset(struct ice_hw *hw);
...@@ -28,8 +28,8 @@ ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res, ...@@ -28,8 +28,8 @@ ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,
enum ice_aq_res_access_type access, u32 timeout); enum ice_aq_res_access_type access, u32 timeout);
void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res); void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res);
enum ice_status ice_init_nvm(struct ice_hw *hw); enum ice_status ice_init_nvm(struct ice_hw *hw);
enum ice_status ice_read_sr_buf(struct ice_hw *hw, u16 offset, u16 *words, enum ice_status
u16 *data); ice_read_sr_buf(struct ice_hw *hw, u16 offset, u16 *words, u16 *data);
enum ice_status enum ice_status
ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
struct ice_aq_desc *desc, void *buf, u16 buf_size, struct ice_aq_desc *desc, void *buf, u16 buf_size,
...@@ -106,8 +106,10 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps, ...@@ -106,8 +106,10 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_qgrps,
enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle); enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle);
void ice_replay_post(struct ice_hw *hw); void ice_replay_post(struct ice_hw *hw);
void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf); void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);
void ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg, void
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat); ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
void ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded, bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat);
u64 *prev_stat, u64 *cur_stat); void
ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
u64 *prev_stat, u64 *cur_stat);
#endif /* _ICE_COMMON_H_ */ #endif /* _ICE_COMMON_H_ */
...@@ -1156,8 +1156,9 @@ ice_get_settings_link_down(struct ethtool_link_ksettings *ks, ...@@ -1156,8 +1156,9 @@ ice_get_settings_link_down(struct ethtool_link_ksettings *ks,
* *
* Reports speed/duplex settings based on media_type * Reports speed/duplex settings based on media_type
*/ */
static int ice_get_link_ksettings(struct net_device *netdev, static int
struct ethtool_link_ksettings *ks) ice_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *ks)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_link_status *hw_link_info; struct ice_link_status *hw_link_info;
...@@ -1565,8 +1566,9 @@ ice_set_link_ksettings(struct net_device *netdev, ...@@ -1565,8 +1566,9 @@ ice_set_link_ksettings(struct net_device *netdev,
* *
* Returns Success if the command is supported. * Returns Success if the command is supported.
*/ */
static int ice_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, static int
u32 __always_unused *rule_locs) ice_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
u32 __always_unused *rule_locs)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
...@@ -2023,8 +2025,9 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) ...@@ -2023,8 +2025,9 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
* Returns -EINVAL if the table specifies an invalid queue id, otherwise * Returns -EINVAL if the table specifies an invalid queue id, otherwise
* returns 0 after programming the table. * returns 0 after programming the table.
*/ */
static int ice_set_rxfh(struct net_device *netdev, const u32 *indir, static int
const u8 *key, const u8 hfunc) ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,
const u8 hfunc)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
...@@ -2179,8 +2182,9 @@ ice_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) ...@@ -2179,8 +2182,9 @@ ice_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec)
return __ice_get_coalesce(netdev, ec, -1); return __ice_get_coalesce(netdev, ec, -1);
} }
static int ice_get_per_q_coalesce(struct net_device *netdev, u32 q_num, static int
struct ethtool_coalesce *ec) ice_get_per_q_coalesce(struct net_device *netdev, u32 q_num,
struct ethtool_coalesce *ec)
{ {
return __ice_get_coalesce(netdev, ec, q_num); return __ice_get_coalesce(netdev, ec, q_num);
} }
...@@ -2324,8 +2328,9 @@ ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) ...@@ -2324,8 +2328,9 @@ ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec)
return __ice_set_coalesce(netdev, ec, -1); return __ice_set_coalesce(netdev, ec, -1);
} }
static int ice_set_per_q_coalesce(struct net_device *netdev, u32 q_num, static int
struct ethtool_coalesce *ec) ice_set_per_q_coalesce(struct net_device *netdev, u32 q_num,
struct ethtool_coalesce *ec)
{ {
return __ice_set_coalesce(netdev, ec, q_num); return __ice_set_coalesce(netdev, ec, q_num);
} }
......
...@@ -297,13 +297,19 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi) ...@@ -297,13 +297,19 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
/** /**
* ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI * ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI
* @vsi: the VSI being configured * @vsi: the VSI being configured
* @vf_id: Id of the VF being configured
* *
* Return 0 on success and a negative value on error * Return 0 on success and a negative value on error
*/ */
static void ice_vsi_set_num_qs(struct ice_vsi *vsi) static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)
{ {
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
struct ice_vf *vf = NULL;
if (vsi->type == ICE_VSI_VF)
vsi->vf_id = vf_id;
switch (vsi->type) { switch (vsi->type) {
case ICE_VSI_PF: case ICE_VSI_PF:
vsi->alloc_txq = pf->num_lan_tx; vsi->alloc_txq = pf->num_lan_tx;
...@@ -311,8 +317,9 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi) ...@@ -311,8 +317,9 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
vsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx); vsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx);
break; break;
case ICE_VSI_VF: case ICE_VSI_VF:
vsi->alloc_txq = pf->num_vf_qps; vf = &pf->vf[vsi->vf_id];
vsi->alloc_rxq = pf->num_vf_qps; vsi->alloc_txq = vf->num_vf_qs;
vsi->alloc_rxq = vf->num_vf_qs;
/* pf->num_vf_msix includes (VF miscellaneous vector + /* pf->num_vf_msix includes (VF miscellaneous vector +
* data queue interrupts). Since vsi->num_q_vectors is number * data queue interrupts). Since vsi->num_q_vectors is number
* of queues vectors, subtract 1 from the original vector * of queues vectors, subtract 1 from the original vector
...@@ -472,10 +479,12 @@ static irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data) ...@@ -472,10 +479,12 @@ static irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data)
* ice_vsi_alloc - Allocates the next available struct VSI in the PF * ice_vsi_alloc - Allocates the next available struct VSI in the PF
* @pf: board private structure * @pf: board private structure
* @type: type of VSI * @type: type of VSI
* @vf_id: Id of the VF being configured
* *
* returns a pointer to a VSI on success, NULL on failure. * returns a pointer to a VSI on success, NULL on failure.
*/ */
static struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type) static struct ice_vsi *
ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type, u16 vf_id)
{ {
struct ice_vsi *vsi = NULL; struct ice_vsi *vsi = NULL;
...@@ -501,7 +510,10 @@ static struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type) ...@@ -501,7 +510,10 @@ static struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type)
vsi->idx = pf->next_vsi; vsi->idx = pf->next_vsi;
vsi->work_lmt = ICE_DFLT_IRQ_WORK; vsi->work_lmt = ICE_DFLT_IRQ_WORK;
ice_vsi_set_num_qs(vsi); if (type == ICE_VSI_VF)
ice_vsi_set_num_qs(vsi, vf_id);
else
ice_vsi_set_num_qs(vsi, ICE_INVAL_VFID);
switch (vsi->type) { switch (vsi->type) {
case ICE_VSI_PF: case ICE_VSI_PF:
...@@ -869,7 +881,18 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) ...@@ -869,7 +881,18 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
tx_count += tx_numq_tc; tx_count += tx_numq_tc;
ctxt->info.tc_mapping[i] = cpu_to_le16(qmap); ctxt->info.tc_mapping[i] = cpu_to_le16(qmap);
} }
vsi->num_rxq = offset;
/* if offset is non-zero, means it is calculated correctly based on
* enabled TCs for a given VSI otherwise qcount_rx will always
* be correct and non-zero because it is based off - VSI's
* allocated Rx queues which is at least 1 (hence qcount_tx will be
* at least 1)
*/
if (offset)
vsi->num_rxq = offset;
else
vsi->num_rxq = qcount_rx;
vsi->num_txq = tx_count; vsi->num_txq = tx_count;
if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) { if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
...@@ -940,6 +963,7 @@ static int ice_vsi_init(struct ice_vsi *vsi) ...@@ -940,6 +963,7 @@ static int ice_vsi_init(struct ice_vsi *vsi)
if (!ctxt) if (!ctxt)
return -ENOMEM; return -ENOMEM;
ctxt->info = vsi->info;
switch (vsi->type) { switch (vsi->type) {
case ICE_VSI_PF: case ICE_VSI_PF:
ctxt->flags = ICE_AQ_VSI_TYPE_PF; ctxt->flags = ICE_AQ_VSI_TYPE_PF;
...@@ -965,6 +989,14 @@ static int ice_vsi_init(struct ice_vsi *vsi) ...@@ -965,6 +989,14 @@ static int ice_vsi_init(struct ice_vsi *vsi)
ctxt->info.sw_id = vsi->port_info->sw_id; ctxt->info.sw_id = vsi->port_info->sw_id;
ice_vsi_setup_q_map(vsi, ctxt); ice_vsi_setup_q_map(vsi, ctxt);
/* Enable MAC Antispoof with new VSI being initialized or updated */
if (vsi->type == ICE_VSI_VF && pf->vf[vsi->vf_id].spoofchk) {
ctxt->info.valid_sections |=
cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);
ctxt->info.sec_flags |=
ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF;
}
ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL); ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);
if (ret) { if (ret) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
...@@ -2075,8 +2107,9 @@ ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, ...@@ -2075,8 +2107,9 @@ ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
* @rst_src: reset source * @rst_src: reset source
* @rel_vmvf_num: Relative id of VF/VM * @rel_vmvf_num: Relative id of VF/VM
*/ */
int ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, int
enum ice_disq_rst_src rst_src, u16 rel_vmvf_num) ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
u16 rel_vmvf_num)
{ {
return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings, return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings,
0); 0);
...@@ -2086,10 +2119,11 @@ int ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, ...@@ -2086,10 +2119,11 @@ int ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi,
* ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI
* @vsi: VSI to enable or disable VLAN pruning on * @vsi: VSI to enable or disable VLAN pruning on
* @ena: set to true to enable VLAN pruning and false to disable it * @ena: set to true to enable VLAN pruning and false to disable it
* @vlan_promisc: enable valid security flags if not in VLAN promiscuous mode
* *
* returns 0 if VSI is updated, negative otherwise * returns 0 if VSI is updated, negative otherwise
*/ */
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena) int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
{ {
struct ice_vsi_ctx *ctxt; struct ice_vsi_ctx *ctxt;
struct device *dev; struct device *dev;
...@@ -2117,8 +2151,10 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena) ...@@ -2117,8 +2151,10 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)
ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA; ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
} }
ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID | if (!vlan_promisc)
ICE_AQ_VSI_PROP_SW_VALID); ctxt->info.valid_sections =
cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID |
ICE_AQ_VSI_PROP_SW_VALID);
status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL); status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL);
if (status) { if (status) {
...@@ -2162,7 +2198,11 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, ...@@ -2162,7 +2198,11 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
struct ice_vsi *vsi; struct ice_vsi *vsi;
int ret, i; int ret, i;
vsi = ice_vsi_alloc(pf, type); if (type == ICE_VSI_VF)
vsi = ice_vsi_alloc(pf, type, vf_id);
else
vsi = ice_vsi_alloc(pf, type, ICE_INVAL_VFID);
if (!vsi) { if (!vsi) {
dev_err(dev, "could not allocate VSI\n"); dev_err(dev, "could not allocate VSI\n");
return NULL; return NULL;
...@@ -2646,6 +2686,7 @@ int ice_vsi_release(struct ice_vsi *vsi) ...@@ -2646,6 +2686,7 @@ int ice_vsi_release(struct ice_vsi *vsi)
int ice_vsi_rebuild(struct ice_vsi *vsi) int ice_vsi_rebuild(struct ice_vsi *vsi)
{ {
u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
struct ice_vf *vf = NULL;
struct ice_pf *pf; struct ice_pf *pf;
int ret, i; int ret, i;
...@@ -2653,16 +2694,38 @@ int ice_vsi_rebuild(struct ice_vsi *vsi) ...@@ -2653,16 +2694,38 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
return -EINVAL; return -EINVAL;
pf = vsi->back; pf = vsi->back;
if (vsi->type == ICE_VSI_VF)
vf = &pf->vf[vsi->vf_id];
ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx); ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);
ice_vsi_free_q_vectors(vsi); ice_vsi_free_q_vectors(vsi);
ice_free_res(vsi->back->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
ice_free_res(vsi->back->hw_irq_tracker, vsi->hw_base_vector, vsi->idx); if (vsi->type != ICE_VSI_VF) {
vsi->sw_base_vector = 0; /* reclaim SW interrupts back to the common pool */
ice_free_res(pf->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
pf->num_avail_sw_msix += vsi->num_q_vectors;
vsi->sw_base_vector = 0;
/* reclaim HW interrupts back to the common pool */
ice_free_res(pf->hw_irq_tracker, vsi->hw_base_vector,
vsi->idx);
pf->num_avail_hw_msix += vsi->num_q_vectors;
} else {
/* Reclaim VF resources back to the common pool for reset and
* and rebuild, with vector reassignment
*/
ice_free_res(pf->hw_irq_tracker, vf->first_vector_idx,
vsi->idx);
pf->num_avail_hw_msix += pf->num_vf_msix;
}
vsi->hw_base_vector = 0; vsi->hw_base_vector = 0;
ice_vsi_clear_rings(vsi); ice_vsi_clear_rings(vsi);
ice_vsi_free_arrays(vsi, false); ice_vsi_free_arrays(vsi, false);
ice_dev_onetime_setup(&vsi->back->hw); ice_dev_onetime_setup(&vsi->back->hw);
ice_vsi_set_num_qs(vsi); if (vsi->type == ICE_VSI_VF)
ice_vsi_set_num_qs(vsi, vf->vf_id);
else
ice_vsi_set_num_qs(vsi, ICE_INVAL_VFID);
ice_vsi_set_tc_cfg(vsi); ice_vsi_set_tc_cfg(vsi);
/* Initialize VSI struct elements and create VSI in FW */ /* Initialize VSI struct elements and create VSI in FW */
......
...@@ -35,7 +35,7 @@ int ...@@ -35,7 +35,7 @@ int
ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
u16 rel_vmvf_num); u16 rel_vmvf_num);
int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena); int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc);
void ice_vsi_delete(struct ice_vsi *vsi); void ice_vsi_delete(struct ice_vsi *vsi);
......
...@@ -167,6 +167,39 @@ static bool ice_vsi_fltr_changed(struct ice_vsi *vsi) ...@@ -167,6 +167,39 @@ static bool ice_vsi_fltr_changed(struct ice_vsi *vsi)
test_bit(ICE_VSI_FLAG_VLAN_FLTR_CHANGED, vsi->flags); test_bit(ICE_VSI_FLAG_VLAN_FLTR_CHANGED, vsi->flags);
} }
/**
* ice_cfg_promisc - Enable or disable promiscuous mode for a given PF
* @vsi: the VSI being configured
* @promisc_m: mask of promiscuous config bits
* @set_promisc: enable or disable promisc flag request
*
*/
static int ice_cfg_promisc(struct ice_vsi *vsi, u8 promisc_m, bool set_promisc)
{
struct ice_hw *hw = &vsi->back->hw;
enum ice_status status = 0;
if (vsi->type != ICE_VSI_PF)
return 0;
if (vsi->vlan_ena) {
status = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_m,
set_promisc);
} else {
if (set_promisc)
status = ice_set_vsi_promisc(hw, vsi->idx, promisc_m,
0);
else
status = ice_clear_vsi_promisc(hw, vsi->idx, promisc_m,
0);
}
if (status)
return -EIO;
return 0;
}
/** /**
* ice_vsi_sync_fltr - Update the VSI filter list to the HW * ice_vsi_sync_fltr - Update the VSI filter list to the HW
* @vsi: ptr to the VSI * @vsi: ptr to the VSI
...@@ -182,6 +215,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ...@@ -182,6 +215,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
enum ice_status status = 0; enum ice_status status = 0;
u32 changed_flags = 0; u32 changed_flags = 0;
u8 promisc_m;
int err = 0; int err = 0;
if (!vsi->netdev) if (!vsi->netdev)
...@@ -245,8 +279,35 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) ...@@ -245,8 +279,35 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)
} }
} }
/* check for changes in promiscuous modes */ /* check for changes in promiscuous modes */
if (changed_flags & IFF_ALLMULTI) if (changed_flags & IFF_ALLMULTI) {
netdev_warn(netdev, "Unsupported configuration\n"); if (vsi->current_netdev_flags & IFF_ALLMULTI) {
if (vsi->vlan_ena)
promisc_m = ICE_MCAST_VLAN_PROMISC_BITS;
else
promisc_m = ICE_MCAST_PROMISC_BITS;
err = ice_cfg_promisc(vsi, promisc_m, true);
if (err) {
netdev_err(netdev, "Error setting Multicast promiscuous mode on VSI %i\n",
vsi->vsi_num);
vsi->current_netdev_flags &= ~IFF_ALLMULTI;
goto out_promisc;
}
} else if (!(vsi->current_netdev_flags & IFF_ALLMULTI)) {
if (vsi->vlan_ena)
promisc_m = ICE_MCAST_VLAN_PROMISC_BITS;
else
promisc_m = ICE_MCAST_PROMISC_BITS;
err = ice_cfg_promisc(vsi, promisc_m, false);
if (err) {
netdev_err(netdev, "Error clearing Multicast promiscuous mode on VSI %i\n",
vsi->vsi_num);
vsi->current_netdev_flags |= IFF_ALLMULTI;
goto out_promisc;
}
}
}
if (((changed_flags & IFF_PROMISC) || promisc_forced_on) || if (((changed_flags & IFF_PROMISC) || promisc_forced_on) ||
test_bit(ICE_VSI_FLAG_PROMISC_CHANGED, vsi->flags)) { test_bit(ICE_VSI_FLAG_PROMISC_CHANGED, vsi->flags)) {
...@@ -1113,8 +1174,9 @@ static void ice_set_ctrlq_len(struct ice_hw *hw) ...@@ -1113,8 +1174,9 @@ static void ice_set_ctrlq_len(struct ice_hw *hw)
* This is a callback function used by the irq_set_affinity_notifier function * This is a callback function used by the irq_set_affinity_notifier function
* so that we may register to receive changes to the irq affinity masks. * so that we may register to receive changes to the irq affinity masks.
*/ */
static void ice_irq_affinity_notify(struct irq_affinity_notify *notify, static void
const cpumask_t *mask) ice_irq_affinity_notify(struct irq_affinity_notify *notify,
const cpumask_t *mask)
{ {
struct ice_q_vector *q_vector = struct ice_q_vector *q_vector =
container_of(notify, struct ice_q_vector, affinity_notify); container_of(notify, struct ice_q_vector, affinity_notify);
...@@ -1658,11 +1720,13 @@ ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) ...@@ -1658,11 +1720,13 @@ ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
* *
* net_device_ops implementation for adding vlan ids * net_device_ops implementation for adding vlan ids
*/ */
static int ice_vlan_rx_add_vid(struct net_device *netdev, static int
__always_unused __be16 proto, u16 vid) ice_vlan_rx_add_vid(struct net_device *netdev, __always_unused __be16 proto,
u16 vid)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
int ret;
if (vid >= VLAN_N_VID) { if (vid >= VLAN_N_VID) {
netdev_err(netdev, "VLAN id requested %d is out of range %d\n", netdev_err(netdev, "VLAN id requested %d is out of range %d\n",
...@@ -1675,8 +1739,7 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, ...@@ -1675,8 +1739,7 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev,
/* Enable VLAN pruning when VLAN 0 is added */ /* Enable VLAN pruning when VLAN 0 is added */
if (unlikely(!vid)) { if (unlikely(!vid)) {
int ret = ice_cfg_vlan_pruning(vsi, true); ret = ice_cfg_vlan_pruning(vsi, true, false);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1685,7 +1748,13 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, ...@@ -1685,7 +1748,13 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev,
* needed to continue allowing all untagged packets since VLAN prune * needed to continue allowing all untagged packets since VLAN prune
* list is applied to all packets by the switch * list is applied to all packets by the switch
*/ */
return ice_vsi_add_vlan(vsi, vid); ret = ice_vsi_add_vlan(vsi, vid);
if (!ret) {
vsi->vlan_ena = true;
set_bit(ICE_VSI_FLAG_VLAN_FLTR_CHANGED, vsi->flags);
}
return ret;
} }
/** /**
...@@ -1696,12 +1765,13 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, ...@@ -1696,12 +1765,13 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev,
* *
* net_device_ops implementation for removing vlan ids * net_device_ops implementation for removing vlan ids
*/ */
static int ice_vlan_rx_kill_vid(struct net_device *netdev, static int
__always_unused __be16 proto, u16 vid) ice_vlan_rx_kill_vid(struct net_device *netdev, __always_unused __be16 proto,
u16 vid)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
int status; int ret;
if (vsi->info.pvid) if (vsi->info.pvid)
return -EINVAL; return -EINVAL;
...@@ -1709,15 +1779,17 @@ static int ice_vlan_rx_kill_vid(struct net_device *netdev, ...@@ -1709,15 +1779,17 @@ static int ice_vlan_rx_kill_vid(struct net_device *netdev,
/* Make sure ice_vsi_kill_vlan is successful before updating VLAN /* Make sure ice_vsi_kill_vlan is successful before updating VLAN
* information * information
*/ */
status = ice_vsi_kill_vlan(vsi, vid); ret = ice_vsi_kill_vlan(vsi, vid);
if (status) if (ret)
return status; return ret;
/* Disable VLAN pruning when VLAN 0 is removed */ /* Disable VLAN pruning when VLAN 0 is removed */
if (unlikely(!vid)) if (unlikely(!vid))
status = ice_cfg_vlan_pruning(vsi, false); ret = ice_cfg_vlan_pruning(vsi, false, false);
return status; vsi->vlan_ena = false;
set_bit(ICE_VSI_FLAG_VLAN_FLTR_CHANGED, vsi->flags);
return ret;
} }
/** /**
...@@ -2057,8 +2129,8 @@ static void ice_verify_cacheline_size(struct ice_pf *pf) ...@@ -2057,8 +2129,8 @@ static void ice_verify_cacheline_size(struct ice_pf *pf)
* *
* Returns 0 on success, negative on failure * Returns 0 on success, negative on failure
*/ */
static int ice_probe(struct pci_dev *pdev, static int
const struct pci_device_id __always_unused *ent) ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ice_pf *pf; struct ice_pf *pf;
...@@ -2493,9 +2565,10 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[], ...@@ -2493,9 +2565,10 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[],
* @addr: the MAC address entry being added * @addr: the MAC address entry being added
* @vid: VLAN id * @vid: VLAN id
*/ */
static int ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[], static int
struct net_device *dev, const unsigned char *addr, ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
__always_unused u16 vid) struct net_device *dev, const unsigned char *addr,
__always_unused u16 vid)
{ {
int err; int err;
...@@ -2519,8 +2592,8 @@ static int ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[], ...@@ -2519,8 +2592,8 @@ static int ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
* @netdev: ptr to the netdev being adjusted * @netdev: ptr to the netdev being adjusted
* @features: the feature set that the stack is suggesting * @features: the feature set that the stack is suggesting
*/ */
static int ice_set_features(struct net_device *netdev, static int
netdev_features_t features) ice_set_features(struct net_device *netdev, netdev_features_t features)
{ {
struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
...@@ -2647,7 +2720,7 @@ static int ice_up_complete(struct ice_vsi *vsi) ...@@ -2647,7 +2720,7 @@ static int ice_up_complete(struct ice_vsi *vsi)
ice_service_task_schedule(pf); ice_service_task_schedule(pf);
return err; return 0;
} }
/** /**
...@@ -2674,8 +2747,8 @@ int ice_up(struct ice_vsi *vsi) ...@@ -2674,8 +2747,8 @@ int ice_up(struct ice_vsi *vsi)
* This function fetches stats from the ring considering the atomic operations * This function fetches stats from the ring considering the atomic operations
* that needs to be performed to read u64 values in 32 bit machine. * that needs to be performed to read u64 values in 32 bit machine.
*/ */
static void ice_fetch_u64_stats_per_ring(struct ice_ring *ring, u64 *pkts, static void
u64 *bytes) ice_fetch_u64_stats_per_ring(struct ice_ring *ring, u64 *pkts, u64 *bytes)
{ {
unsigned int start; unsigned int start;
*pkts = 0; *pkts = 0;
......
...@@ -276,7 +276,8 @@ ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent, ...@@ -276,7 +276,8 @@ ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent,
status = ice_aq_delete_sched_elems(hw, 1, buf, buf_size, status = ice_aq_delete_sched_elems(hw, 1, buf, buf_size,
&num_groups_removed, NULL); &num_groups_removed, NULL);
if (status || num_groups_removed != 1) if (status || num_groups_removed != 1)
ice_debug(hw, ICE_DBG_SCHED, "remove elements failed\n"); ice_debug(hw, ICE_DBG_SCHED, "remove node failed FW error %d\n",
hw->adminq.sq_last_status);
devm_kfree(ice_hw_to_dev(hw), buf); devm_kfree(ice_hw_to_dev(hw), buf);
return status; return status;
...@@ -360,12 +361,8 @@ void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node) ...@@ -360,12 +361,8 @@ void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node)
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_ROOT_PORT && node->info.data.elem_type != ICE_AQC_ELEM_TYPE_ROOT_PORT &&
node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF) { node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF) {
u32 teid = le32_to_cpu(node->info.node_teid); u32 teid = le32_to_cpu(node->info.node_teid);
enum ice_status status;
status = ice_sched_remove_elems(hw, node->parent, 1, &teid); ice_sched_remove_elems(hw, node->parent, 1, &teid);
if (status)
ice_debug(hw, ICE_DBG_SCHED,
"remove element failed %d\n", status);
} }
parent = node->parent; parent = node->parent;
/* root has no parent */ /* root has no parent */
...@@ -697,7 +694,8 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node, ...@@ -697,7 +694,8 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
status = ice_aq_add_sched_elems(hw, 1, buf, buf_size, status = ice_aq_add_sched_elems(hw, 1, buf, buf_size,
&num_groups_added, NULL); &num_groups_added, NULL);
if (status || num_groups_added != 1) { if (status || num_groups_added != 1) {
ice_debug(hw, ICE_DBG_SCHED, "add elements failed\n"); ice_debug(hw, ICE_DBG_SCHED, "add node failed FW Error %d\n",
hw->adminq.sq_last_status);
devm_kfree(ice_hw_to_dev(hw), buf); devm_kfree(ice_hw_to_dev(hw), buf);
return ICE_ERR_CFG; return ICE_ERR_CFG;
} }
...@@ -1502,7 +1500,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle, ...@@ -1502,7 +1500,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,
vsi_ctx->sched.max_lanq[tc] = new_numqs; vsi_ctx->sched.max_lanq[tc] = new_numqs;
return status; return 0;
} }
/** /**
...@@ -1527,6 +1525,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs, ...@@ -1527,6 +1525,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,
enum ice_status status = 0; enum ice_status status = 0;
struct ice_hw *hw = pi->hw; struct ice_hw *hw = pi->hw;
ice_debug(pi->hw, ICE_DBG_SCHED, "add/config VSI %d\n", vsi_handle);
tc_node = ice_sched_get_tc_node(pi, tc); tc_node = ice_sched_get_tc_node(pi, tc);
if (!tc_node) if (!tc_node)
return ICE_ERR_PARAM; return ICE_ERR_PARAM;
...@@ -1646,8 +1645,9 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner) ...@@ -1646,8 +1645,9 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
{ {
enum ice_status status = ICE_ERR_PARAM; enum ice_status status = ICE_ERR_PARAM;
struct ice_vsi_ctx *vsi_ctx; struct ice_vsi_ctx *vsi_ctx;
u8 i, j = 0; u8 i;
ice_debug(pi->hw, ICE_DBG_SCHED, "removing VSI %d\n", vsi_handle);
if (!ice_is_vsi_valid(pi->hw, vsi_handle)) if (!ice_is_vsi_valid(pi->hw, vsi_handle))
return status; return status;
mutex_lock(&pi->sched_lock); mutex_lock(&pi->sched_lock);
...@@ -1657,6 +1657,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner) ...@@ -1657,6 +1657,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) { for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) {
struct ice_sched_node *vsi_node, *tc_node; struct ice_sched_node *vsi_node, *tc_node;
u8 j = 0;
tc_node = ice_sched_get_tc_node(pi, i); tc_node = ice_sched_get_tc_node(pi, i);
if (!tc_node) if (!tc_node)
......
This diff is collapsed.
...@@ -178,6 +178,17 @@ struct ice_fltr_mgmt_list_entry { ...@@ -178,6 +178,17 @@ struct ice_fltr_mgmt_list_entry {
u8 counter_index; u8 counter_index;
}; };
enum ice_promisc_flags {
ICE_PROMISC_UCAST_RX = 0x1,
ICE_PROMISC_UCAST_TX = 0x2,
ICE_PROMISC_MCAST_RX = 0x4,
ICE_PROMISC_MCAST_TX = 0x8,
ICE_PROMISC_BCAST_RX = 0x10,
ICE_PROMISC_BCAST_TX = 0x20,
ICE_PROMISC_VLAN_RX = 0x40,
ICE_PROMISC_VLAN_TX = 0x80,
};
/* VSI related commands */ /* VSI related commands */
enum ice_status enum ice_status
ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
...@@ -199,10 +210,22 @@ enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw); ...@@ -199,10 +210,22 @@ enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);
enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst);
void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle);
enum ice_status ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); enum ice_status
ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);
enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list);
/* Promisc/defport setup for VSIs */
enum ice_status enum ice_status
ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction); ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction);
enum ice_status
ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
u16 vid);
enum ice_status
ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
u16 vid);
enum ice_status
ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
bool rm_vlan_promisc);
enum ice_status ice_init_def_sw_recp(struct ice_hw *hw); enum ice_status ice_init_def_sw_recp(struct ice_hw *hw);
u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle);
......
...@@ -100,8 +100,8 @@ void ice_free_tx_ring(struct ice_ring *tx_ring) ...@@ -100,8 +100,8 @@ void ice_free_tx_ring(struct ice_ring *tx_ring)
* *
* Returns true if there's any budget left (e.g. the clean is finished) * Returns true if there's any budget left (e.g. the clean is finished)
*/ */
static bool ice_clean_tx_irq(struct ice_vsi *vsi, struct ice_ring *tx_ring, static bool
int napi_budget) ice_clean_tx_irq(struct ice_vsi *vsi, struct ice_ring *tx_ring, int napi_budget)
{ {
unsigned int total_bytes = 0, total_pkts = 0; unsigned int total_bytes = 0, total_pkts = 0;
unsigned int budget = vsi->work_lmt; unsigned int budget = vsi->work_lmt;
...@@ -389,8 +389,8 @@ static void ice_release_rx_desc(struct ice_ring *rx_ring, u32 val) ...@@ -389,8 +389,8 @@ static void ice_release_rx_desc(struct ice_ring *rx_ring, u32 val)
* Returns true if the page was successfully allocated or * Returns true if the page was successfully allocated or
* reused. * reused.
*/ */
static bool ice_alloc_mapped_page(struct ice_ring *rx_ring, static bool
struct ice_rx_buf *bi) ice_alloc_mapped_page(struct ice_ring *rx_ring, struct ice_rx_buf *bi)
{ {
struct page *page = bi->page; struct page *page = bi->page;
dma_addr_t dma; dma_addr_t dma;
...@@ -510,9 +510,9 @@ static bool ice_page_is_reserved(struct page *page) ...@@ -510,9 +510,9 @@ static bool ice_page_is_reserved(struct page *page)
* The function will then update the page offset if necessary and return * The function will then update the page offset if necessary and return
* true if the buffer can be reused by the adapter. * true if the buffer can be reused by the adapter.
*/ */
static bool ice_add_rx_frag(struct ice_rx_buf *rx_buf, static bool
union ice_32b_rx_flex_desc *rx_desc, ice_add_rx_frag(struct ice_rx_buf *rx_buf, union ice_32b_rx_flex_desc *rx_desc,
struct sk_buff *skb) struct sk_buff *skb)
{ {
#if (PAGE_SIZE < 8192) #if (PAGE_SIZE < 8192)
unsigned int truesize = ICE_RXBUF_2048; unsigned int truesize = ICE_RXBUF_2048;
...@@ -587,8 +587,8 @@ static bool ice_add_rx_frag(struct ice_rx_buf *rx_buf, ...@@ -587,8 +587,8 @@ static bool ice_add_rx_frag(struct ice_rx_buf *rx_buf,
* *
* Synchronizes page for reuse by the adapter * Synchronizes page for reuse by the adapter
*/ */
static void ice_reuse_rx_page(struct ice_ring *rx_ring, static void
struct ice_rx_buf *old_buf) ice_reuse_rx_page(struct ice_ring *rx_ring, struct ice_rx_buf *old_buf)
{ {
u16 nta = rx_ring->next_to_alloc; u16 nta = rx_ring->next_to_alloc;
struct ice_rx_buf *new_buf; struct ice_rx_buf *new_buf;
...@@ -613,8 +613,8 @@ static void ice_reuse_rx_page(struct ice_ring *rx_ring, ...@@ -613,8 +613,8 @@ static void ice_reuse_rx_page(struct ice_ring *rx_ring,
* correctly, as well as handling calling the page recycle function if * correctly, as well as handling calling the page recycle function if
* necessary. * necessary.
*/ */
static struct sk_buff *ice_fetch_rx_buf(struct ice_ring *rx_ring, static struct sk_buff *
union ice_32b_rx_flex_desc *rx_desc) ice_fetch_rx_buf(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc)
{ {
struct ice_rx_buf *rx_buf; struct ice_rx_buf *rx_buf;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -751,8 +751,8 @@ static bool ice_cleanup_headers(struct sk_buff *skb) ...@@ -751,8 +751,8 @@ static bool ice_cleanup_headers(struct sk_buff *skb)
* The status_error_len doesn't need to be shifted because it begins * The status_error_len doesn't need to be shifted because it begins
* at offset zero. * at offset zero.
*/ */
static bool ice_test_staterr(union ice_32b_rx_flex_desc *rx_desc, static bool
const u16 stat_err_bits) ice_test_staterr(union ice_32b_rx_flex_desc *rx_desc, const u16 stat_err_bits)
{ {
return !!(rx_desc->wb.status_error0 & return !!(rx_desc->wb.status_error0 &
cpu_to_le16(stat_err_bits)); cpu_to_le16(stat_err_bits));
...@@ -769,9 +769,9 @@ static bool ice_test_staterr(union ice_32b_rx_flex_desc *rx_desc, ...@@ -769,9 +769,9 @@ static bool ice_test_staterr(union ice_32b_rx_flex_desc *rx_desc,
* sk_buff in the next buffer to be chained and return true indicating * sk_buff in the next buffer to be chained and return true indicating
* that this is in fact a non-EOP buffer. * that this is in fact a non-EOP buffer.
*/ */
static bool ice_is_non_eop(struct ice_ring *rx_ring, static bool
union ice_32b_rx_flex_desc *rx_desc, ice_is_non_eop(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc,
struct sk_buff *skb) struct sk_buff *skb)
{ {
u32 ntc = rx_ring->next_to_clean + 1; u32 ntc = rx_ring->next_to_clean + 1;
...@@ -838,8 +838,9 @@ ice_rx_hash(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc, ...@@ -838,8 +838,9 @@ ice_rx_hash(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc,
* *
* skb->protocol must be set before this function is called * skb->protocol must be set before this function is called
*/ */
static void ice_rx_csum(struct ice_vsi *vsi, struct sk_buff *skb, static void
union ice_32b_rx_flex_desc *rx_desc, u8 ptype) ice_rx_csum(struct ice_vsi *vsi, struct sk_buff *skb,
union ice_32b_rx_flex_desc *rx_desc, u8 ptype)
{ {
struct ice_rx_ptype_decoded decoded; struct ice_rx_ptype_decoded decoded;
u32 rx_error, rx_status; u32 rx_error, rx_status;
...@@ -909,9 +910,10 @@ static void ice_rx_csum(struct ice_vsi *vsi, struct sk_buff *skb, ...@@ -909,9 +910,10 @@ static void ice_rx_csum(struct ice_vsi *vsi, struct sk_buff *skb,
* order to populate the hash, checksum, VLAN, protocol, and * order to populate the hash, checksum, VLAN, protocol, and
* other fields within the skb. * other fields within the skb.
*/ */
static void ice_process_skb_fields(struct ice_ring *rx_ring, static void
union ice_32b_rx_flex_desc *rx_desc, ice_process_skb_fields(struct ice_ring *rx_ring,
struct sk_buff *skb, u8 ptype) union ice_32b_rx_flex_desc *rx_desc,
struct sk_buff *skb, u8 ptype)
{ {
ice_rx_hash(rx_ring, rx_desc, skb, ptype); ice_rx_hash(rx_ring, rx_desc, skb, ptype);
...@@ -930,8 +932,8 @@ static void ice_process_skb_fields(struct ice_ring *rx_ring, ...@@ -930,8 +932,8 @@ static void ice_process_skb_fields(struct ice_ring *rx_ring,
* This function sends the completed packet (via. skb) up the stack using * This function sends the completed packet (via. skb) up the stack using
* gro receive functions (with/without vlan tag) * gro receive functions (with/without vlan tag)
*/ */
static void ice_receive_skb(struct ice_ring *rx_ring, struct sk_buff *skb, static void
u16 vlan_tag) ice_receive_skb(struct ice_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag)
{ {
if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
(vlan_tag & VLAN_VID_MASK)) { (vlan_tag & VLAN_VID_MASK)) {
......
...@@ -248,7 +248,6 @@ struct ice_sched_vsi_info { ...@@ -248,7 +248,6 @@ struct ice_sched_vsi_info {
struct ice_sched_node *ag_node[ICE_MAX_TRAFFIC_CLASS]; struct ice_sched_node *ag_node[ICE_MAX_TRAFFIC_CLASS];
struct list_head list_entry; struct list_head list_entry;
u16 max_lanq[ICE_MAX_TRAFFIC_CLASS]; u16 max_lanq[ICE_MAX_TRAFFIC_CLASS];
u16 vsi_id;
}; };
/* driver defines the policy */ /* driver defines the policy */
......
...@@ -70,6 +70,7 @@ struct ice_vf { ...@@ -70,6 +70,7 @@ struct ice_vf {
u8 spoofchk; u8 spoofchk;
u16 num_mac; u16 num_mac;
u16 num_vlan; u16 num_vlan;
u16 num_vf_qs; /* num of queue configured per VF */
u8 num_req_qs; /* num of queue pairs requested by VF */ u8 num_req_qs; /* num of queue pairs requested by VF */
}; };
...@@ -77,8 +78,8 @@ struct ice_vf { ...@@ -77,8 +78,8 @@ struct ice_vf {
void ice_process_vflr_event(struct ice_pf *pf); void ice_process_vflr_event(struct ice_pf *pf);
int ice_sriov_configure(struct pci_dev *pdev, int num_vfs); int ice_sriov_configure(struct pci_dev *pdev, int num_vfs);
int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac); int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
int ice_get_vf_cfg(struct net_device *netdev, int vf_id, int
struct ifla_vf_info *ivi); ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi);
void ice_free_vfs(struct ice_pf *pf); void ice_free_vfs(struct ice_pf *pf);
void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event); void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event);
...@@ -86,11 +87,9 @@ void ice_vc_notify_link_state(struct ice_pf *pf); ...@@ -86,11 +87,9 @@ void ice_vc_notify_link_state(struct ice_pf *pf);
void ice_vc_notify_reset(struct ice_pf *pf); void ice_vc_notify_reset(struct ice_pf *pf);
bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr); bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr);
int ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, int
u16 vlan_id, u8 qos, __be16 vlan_proto); ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
__be16 vlan_proto);
int ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
int max_tx_rate);
int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted); int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted);
...@@ -162,12 +161,5 @@ ice_set_vf_link_state(struct net_device __always_unused *netdev, ...@@ -162,12 +161,5 @@ ice_set_vf_link_state(struct net_device __always_unused *netdev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline int
ice_set_vf_bw(struct net_device __always_unused *netdev,
int __always_unused vf_id, int __always_unused min_tx_rate,
int __always_unused max_tx_rate)
{
return -EOPNOTSUPP;
}
#endif /* CONFIG_PCI_IOV */ #endif /* CONFIG_PCI_IOV */
#endif /* _ICE_VIRTCHNL_PF_H_ */ #endif /* _ICE_VIRTCHNL_PF_H_ */
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