net/ice/base: fix rate limit burst size calculation
When the MSB is not set, the lower 11 bits do not represent bytes, but
chunks of 64 bytes. Adjust the rate limit burst size calculation
accordingly, and update the comments to indicate the way the hardware
actually works.
Fixes: 93e84b1bfc
("net/ice/base: add basic Tx scheduler")
Cc: stable@dpdk.org
Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
parent
d678184976
commit
e4b73bee79
@ -5060,16 +5060,15 @@ enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes)
|
||||
if (bytes < ICE_MIN_BURST_SIZE_ALLOWED ||
|
||||
bytes > ICE_MAX_BURST_SIZE_ALLOWED)
|
||||
return ICE_ERR_PARAM;
|
||||
if (bytes <= ICE_MAX_BURST_SIZE_BYTE_GRANULARITY) {
|
||||
/* byte granularity case */
|
||||
if (ice_round_to_num(bytes, 64) <=
|
||||
ICE_MAX_BURST_SIZE_64_BYTE_GRANULARITY) {
|
||||
/* 64 byte granularity case */
|
||||
/* Disable MSB granularity bit */
|
||||
burst_size_to_prog = ICE_BYTE_GRANULARITY;
|
||||
/* round number to nearest 256 granularity */
|
||||
bytes = ice_round_to_num(bytes, 256);
|
||||
/* check rounding doesn't go beyond allowed */
|
||||
if (bytes > ICE_MAX_BURST_SIZE_BYTE_GRANULARITY)
|
||||
bytes = ICE_MAX_BURST_SIZE_BYTE_GRANULARITY;
|
||||
burst_size_to_prog |= (u16)bytes;
|
||||
burst_size_to_prog = ICE_64_BYTE_GRANULARITY;
|
||||
/* round number to nearest 64 byte granularity */
|
||||
bytes = ice_round_to_num(bytes, 64);
|
||||
/* The value is in 64 byte chunks */
|
||||
burst_size_to_prog |= (u16)(bytes / 64);
|
||||
} else {
|
||||
/* k bytes granularity case */
|
||||
/* Enable MSB granularity bit */
|
||||
|
@ -13,14 +13,16 @@
|
||||
#define ICE_SCHED_INVAL_LAYER_NUM 0xFF
|
||||
/* Burst size is a 12 bits register that is configured while creating the RL
|
||||
* profile(s). MSB is a granularity bit and tells the granularity type
|
||||
* 0 - LSB bits are in bytes granularity
|
||||
* 0 - LSB bits are in 64 bytes granularity
|
||||
* 1 - LSB bits are in 1K bytes granularity
|
||||
*/
|
||||
#define ICE_BYTE_GRANULARITY 0
|
||||
#define ICE_KBYTE_GRANULARITY 0x800
|
||||
#define ICE_MIN_BURST_SIZE_ALLOWED 1 /* In Bytes */
|
||||
#define ICE_MAX_BURST_SIZE_ALLOWED (2047 * 1024) /* In Bytes */
|
||||
#define ICE_MAX_BURST_SIZE_BYTE_GRANULARITY 2047 /* In Bytes */
|
||||
#define ICE_64_BYTE_GRANULARITY 0
|
||||
#define ICE_KBYTE_GRANULARITY BIT(11)
|
||||
#define ICE_MIN_BURST_SIZE_ALLOWED 64 /* In Bytes */
|
||||
#define ICE_MAX_BURST_SIZE_ALLOWED \
|
||||
((BIT(11) - 1) * 1024) /* In Bytes */
|
||||
#define ICE_MAX_BURST_SIZE_64_BYTE_GRANULARITY \
|
||||
((BIT(11) - 1) * 64) /* In Bytes */
|
||||
#define ICE_MAX_BURST_SIZE_KBYTE_GRANULARITY ICE_MAX_BURST_SIZE_ALLOWED
|
||||
|
||||
#define ICE_RL_PROF_FREQUENCY 446000000
|
||||
|
Loading…
Reference in New Issue
Block a user