Skip to content

Commit

Permalink
ice: Support VF queue rate limit and quanta size configuration
Browse files Browse the repository at this point in the history
Add support to configure VF queue rate limit and quanta size.

For quanta size configuration, the quanta profiles are divided evenly
by PF numbers. For each port, the first quanta profile is reserved for
default. When VF is asked to set queue quanta size, PF will search for
an available profile, change the fields and assigned this profile to the
queue.

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Link: https://patch.msgid.link/fddefc2c1ec3ab32b241ce444af401da19e834dd.1728460186.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Wenjun Wu authored and Jakub Kicinski committed Oct 10, 2024
1 parent 608a5c0 commit 0153077
Show file tree
Hide file tree
Showing 10 changed files with 395 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ struct ice_pf {
struct ice_agg_node vf_agg_node[ICE_MAX_VF_AGG_NODES];
struct ice_dplls dplls;
struct device *hwmon_dev;

u8 num_quanta_prof_used;
};

extern struct workqueue_struct *ice_lag_wq;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ ice_setup_tx_ctx(struct ice_tx_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf
break;
}

tlan_ctx->quanta_prof_idx = ring->quanta_prof_id;

tlan_ctx->tso_ena = ICE_TX_LEGACY;
tlan_ctx->tso_qnum = pf_q;

Expand Down
21 changes: 21 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,25 @@ ice_parse_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
ice_recalc_port_limited_caps(hw, &func_p->common_cap);
}

/**
* ice_func_id_to_logical_id - map from function id to logical pf id
* @active_function_bitmap: active function bitmap
* @pf_id: function number of device
*
* Return: logical PF ID.
*/
static int ice_func_id_to_logical_id(u32 active_function_bitmap, u8 pf_id)
{
u8 logical_id = 0;
u8 i;

for (i = 0; i < pf_id; i++)
if (active_function_bitmap & BIT(i))
logical_id++;

return logical_id;
}

/**
* ice_parse_valid_functions_cap - Parse ICE_AQC_CAPS_VALID_FUNCTIONS caps
* @hw: pointer to the HW struct
Expand All @@ -2453,6 +2472,8 @@ ice_parse_valid_functions_cap(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
dev_p->num_funcs = hweight32(number);
ice_debug(hw, ICE_DBG_INIT, "dev caps: num_funcs = %d\n",
dev_p->num_funcs);

hw->logical_pf_id = ice_func_id_to_logical_id(number, hw->pf_id);
}

/**
Expand Down
8 changes: 8 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_hw_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
#ifndef _ICE_HW_AUTOGEN_H_
#define _ICE_HW_AUTOGEN_H_

#define GLCOMM_QUANTA_PROF(_i) (0x002D2D68 + ((_i) * 4))
#define GLCOMM_QUANTA_PROF_MAX_INDEX 15
#define GLCOMM_QUANTA_PROF_QUANTA_SIZE_S 0
#define GLCOMM_QUANTA_PROF_QUANTA_SIZE_M ICE_M(0x3FFF, 0)
#define GLCOMM_QUANTA_PROF_MAX_CMD_S 16
#define GLCOMM_QUANTA_PROF_MAX_CMD_M ICE_M(0xFF, 16)
#define GLCOMM_QUANTA_PROF_MAX_DESC_S 24
#define GLCOMM_QUANTA_PROF_MAX_DESC_M ICE_M(0x3F, 24)
#define QTX_COMM_DBELL(_DBQM) (0x002C0000 + ((_DBQM) * 4))
#define QTX_COMM_HEAD(_DBQM) (0x000E0000 + ((_DBQM) * 4))
#define QTX_COMM_HEAD_HEAD_S 0
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ice/ice_txrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ struct ice_tx_ring {
#define ICE_TX_FLAGS_RING_VLAN_L2TAG2 BIT(2)
u8 flags;
u8 dcb_tc; /* Traffic class of ring */
u16 quanta_prof_id;
} ____cacheline_internodealigned_in_smp;

static inline bool ice_ring_uses_build_skb(struct ice_rx_ring *ring)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ice/ice_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ struct ice_hw {
u8 revision_id;

u8 pf_id; /* device profile info */
u8 logical_pf_id;

u16 max_burst_size; /* driver sets this value */

Expand Down
8 changes: 8 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_vf_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ struct ice_fdir_prof_info {
u64 fdir_active_cnt;
};

struct ice_vf_qs_bw {
u32 committed;
u32 peak;
u16 queue_id;
u8 tc;
};

/* VF operations */
struct ice_vf_ops {
enum ice_disq_rst_src reset_type;
Expand Down Expand Up @@ -140,6 +147,7 @@ struct ice_vf {
struct devlink_port devlink_port;

u16 num_msix; /* num of MSI-X configured on this VF */
struct ice_vf_qs_bw qs_bw[ICE_MAX_RSS_QS_PER_VF];
};

/* Flags for controlling behavior of ice_reset_vf */
Expand Down
Loading

0 comments on commit 0153077

Please sign in to comment.