fix MPRQ prepare
cover fix MPRQ prepare
From: Michael Baum <[email protected]>
Prepare Multy-Packet RQ and fix missing devargs check.
Michael Baum (3):
common/mlx5: add min WQE size for striding RQ net/mlx5: improve stride parameter names net/mlx5: fix missing adjustment MPRQ stride devargs
drivers/common/mlx5/mlx5_devx_cmds.c | 16 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 11 +- drivers/net/mlx5/linux/mlx5_os.c | 56 ++---- drivers/net/mlx5/linux/mlx5_verbs.c | 4 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 12 +- drivers/net/mlx5/mlx5_defs.h | 4 +- drivers/net/mlx5/mlx5_devx.c | 4 +- drivers/net/mlx5/mlx5_rx.c | 22 +-- drivers/net/mlx5/mlx5_rx.h | 12 +- drivers/net/mlx5/mlx5_rxq.c | 247 ++++++++++++++++++--------- drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +- 13 files changed, 240 insertions(+), 161 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 common/mlx5: add min WQE size for striding RQ
From: Michael Baum <[email protected]>
Some devices have a WQE size limit for striding RQ. On some newer devices, this limitation is smaller and information on its size is provided by the firmware.
This patch adds the attribute query from firmware: the minimum required size of WQE in a strided RQ in granularity of Bytes.
--- drivers/common/mlx5/mlx5_devx_cmds.c | 16 ++++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_devx_cmds.c +16 -0
@@ -823,6 +823,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, {uint32_t in[MLX5_ST_SZ_DW (query_hca_cap_in)] = {0 };uint32_t out[MLX5_ST_SZ_DW (query_hca_cap_out)] = {0 }; +bool hca_cap_2_sup;uint64_t general_obj_types_supported =0 ;void *hcattr;int rc, i;
@@ -832,6 +833,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, MLX5_HCA_CAP_OPMOD_GET_CUR);if (!hcattr)return rc; + hca_cap_2_sup =MLX5_GET (cmd_hca_cap, hcattr, hca_cap_2); attr->max_wqe_sz_sq =MLX5_GET (cmd_hca_cap, hcattr, max_wqe_sz_sq); attr->flow_counter_bulk_alloc_bitmap =MLX5_GET (cmd_hca_cap, hcattr, flow_counter_bulk_alloc);
@@ -967,6 +969,20 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, general_obj_types) & MLX5_GENERAL_OBJ_TYPES_CAP_CONN_TRACK_OFFLOAD); attr->rq_delay_drop =MLX5_GET (cmd_hca_cap, hcattr, rq_delay_drop); +if (hca_cap_2_sup) { + hcattr =mlx5_devx_get_hca_cap (ctx, in, out, &rc, +MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 | +MLX5_HCA_CAP_OPMOD_GET_CUR ); +if (!hcattr) { +DRV_LOG (DEBUG , +"Failed to query DevX HCA capabilities 2." ); +return rc; + } + attr->log_min_stride_wqe_sz =MLX5_GET (cmd_hca_cap_2, hcattr, + log_min_stride_wqe_sz); + } +if (attr->log_min_stride_wqe_sz ==0 ) + attr->log_min_stride_wqe_sz =MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE ;if (attr->qos.sup) { hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc, MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP |
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -251,6 +251,7 @@ struct mlx5_hca_attr { uint32_t log_max_mmo_decompress:5; uint32_t umr_modify_entity_size_disabled:1; uint32_t umr_indirect_mkey_disabled:1; + uint32_t log_min_stride_wqe_sz:5;uint16_t max_wqe_sz_sq; };
drivers/common/mlx5/mlx5_prm.h +9 -2
@@ -264,6 +264,9 @@/* The maximum log value of segments per RQ WQE. */ #define MLX5_MAX_LOG_RQ_SEGS 5u +/* Log 2 of the default size of a WQE for Multi-Packet RQ. */ +#define MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE 14U +/* The alignment needed for WQ buffer. */ #define MLX5_WQE_BUF_ALIGNMENT rte_mem_page_size()
@@ -1342,7 +1345,9 @@ enum {#define MLX5_STEERING_LOGIC_FORMAT_CONNECTX_6DX 0x1struct mlx5_ifc_cmd_hca_cap_bits { -u8 reserved_at_0[0x30 ]; +u8 reserved_at_0[0x20 ]; +u8 hca_cap_2[0x1 ]; +u8 reserved_at_21[0xf ];u8 vhca_id[0x10 ];u8 reserved_at_40[0x20 ];u8 reserved_at_60[0x3 ];
@@ -1909,7 +1914,8 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {u8 max_reformat_insert_offset[0x8 ];u8 max_reformat_remove_size[0x8 ];u8 max_reformat_remove_offset[0x8 ];/* End of DW6. */ -u8 aso_conntrack_reg_id[0x8 ]; +u8 reserved_at_c0[0x3 ]; +u8 log_min_stride_wqe_sz[0x5 ];u8 reserved_at_c8[0x3 ];u8 log_conn_track_granularity[0x5 ];u8 reserved_at_d0[0x3 ];
@@ -1922,6 +1928,7 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {union mlx5_ifc_hca_cap_union_bits {struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap; +struct mlx5_ifc_cmd_hca_cap_2_bits cmd_hca_cap_2;struct mlx5_ifc_per_protocol_networking_offload_caps_bits per_protocol_networking_offload_caps;struct mlx5_ifc_qos_cap_bits qos_cap;
Signature · 1 line
2.25.1
Re: [PATCH 1/3] common/mlx5: add min WQE size for striding RQ
Quoted 8 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
Some devices have a WQE size limit for striding RQ. On some newer devices, this limitation is smaller and information on its size is provided by the firmware.
This patch adds the attribute query from firmware: the minimum required size of WQE in a strided RQ in granularity of Bytes.
? s/strided/strode/
Quoted 3 lines
This is not a fix, why requesting to backport it?
Patch is to use FW provided capability value, which is not used before.
Quoted 2 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>
RE: [PATCH 1/3] common/mlx5: add min WQE size for striding RQ
Quoted 4 lines · On 12/07/2021 3:32 PM, [email protected] wrote:
Quoted 2 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
Quoted 8 lines
Quoted 6 lines
Some devices have a WQE size limit for striding RQ. On some newer devices, this limitation is smaller and information on its size is provided by the firmware.
This patch adds the attribute query from firmware: the minimum required size of WQE in a strided RQ in granularity of Bytes.
? s/strided/strode/
Thanks for the comment.
Let's replace it to "the minimum required size of WQE buffer for striding RQ in granularity of Bytes".
Quoted 7 lines
Quoted 4 lines
This is not a fix, why requesting to backport it?
Patch is to use FW provided capability value, which is not used before.
It is requesting for fix coming after (net/mlx5: fix missing adjustment MPRQ stride devargs). The fix use this capability.
Quoted 3 lines
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>
PATCH 2/3 net/mlx5: improve stride parameter names
In reply to [email protected]From: Michael Baum <[email protected]>
In the striding RQ management there are two important parameters, the size of the single stride in bytes and the number of strides.
Both the data-path structure and config structure keep the log of the above parameters. However, in their names there is no mention that the value is a log which may be misleading as if the fields represent the values themselves.
This patch updates their names describing the values more accurately.
--- drivers/net/mlx5/linux/mlx5_os.c | 38 +++++------ drivers/net/mlx5/linux/mlx5_verbs.c | 4 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 8 +-- drivers/net/mlx5/mlx5_defs.h | 4 +- drivers/net/mlx5/mlx5_devx.c | 4 +- drivers/net/mlx5/mlx5_rx.c | 22 +++--- drivers/net/mlx5/mlx5_rx.h | 12 ++-- drivers/net/mlx5/mlx5_rxq.c | 102 +++++++++++++++------------- drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +-- 10 files changed, 106 insertions(+), 100 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +19 -19
@@ -1549,34 +1549,34 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,DRV_LOG (DEBUG ,"FCS stripping configuration is %ssupported" , (config->hw_fcs_strip ?"" :"not " ));if (config->mprq.enabled && mprq) { -if (config->mprq.stride_num_n && - (config->mprq.stride_num_n > mprq_max_stride_num_n || - config->mprq.stride_num_n < mprq_min_stride_num_n)) { - config->mprq.stride_num_n = -RTE_MIN (RTE_MAX (MLX5_MPRQ_STRIDE_NUM_N , - mprq_min_stride_num_n), - mprq_max_stride_num_n); +if (config->mprq.log_stride_num && + (config->mprq.log_stride_num > mprq_max_stride_num_n || + config->mprq.log_stride_num < mprq_min_stride_num_n)) { + config->mprq.log_stride_num = +RTE_MIN (RTE_MAX (MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM , + mprq_min_stride_num_n), + mprq_max_stride_num_n);DRV_LOG (WARNING ,"the number of strides" " for Multi-Packet RQ is out of range," " setting default value (%u)" , -1 << config->mprq.stride_num_n); - } -if (config->mprq.stride_size_n && - (config->mprq.stride_size_n > mprq_max_stride_size_n || - config->mprq.stride_size_n < mprq_min_stride_size_n)) { - config->mprq.stride_size_n = -RTE_MIN (RTE_MAX (MLX5_MPRQ_STRIDE_SIZE_N , - mprq_min_stride_size_n), - mprq_max_stride_size_n); +1 << config->mprq.log_stride_num); + } +if (config->mprq.log_stride_size && + (config->mprq.log_stride_size > mprq_max_stride_size_n || + config->mprq.log_stride_size < mprq_min_stride_size_n)) { + config->mprq.log_stride_size = +RTE_MIN (RTE_MAX (MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE , + mprq_min_stride_size_n), + mprq_max_stride_size_n);DRV_LOG (WARNING ,"the size of a stride" " for Multi-Packet RQ is out of range," " setting default value (%u)" , -1 << config->mprq.stride_size_n); +1 << config->mprq.log_stride_size); } - config->mprq.min_stride_size_n = mprq_min_stride_size_n; - config->mprq.max_stride_size_n = mprq_max_stride_size_n; + config->mprq.log_min_stride_size = mprq_min_stride_size_n; + config->mprq.log_max_stride_size = mprq_max_stride_size_n; }else if (config->mprq.enabled && !mprq) {DRV_LOG (WARNING ,"Multi-Packet RQ isn't supported" ); config->mprq.enabled =0 ;
drivers/net/mlx5/linux/mlx5_verbs.c +2 -2
@@ -272,8 +272,8 @@ mlx5_rxq_ibv_wq_create(struct mlx5_rxq_priv *rxq) wq_attr.mlx5.comp_mask |=MLX5DV_WQ_INIT_ATTR_MASK_STRIDING_RQ ; *mprq_attr = (struct mlx5dv_striding_rq_init_attr ){ - .single_stride_log_num_of_bytes = rxq_data->strd_sz_n, - .single_wqe_log_num_of_strides = rxq_data->strd_num_n, + .single_stride_log_num_of_bytes = rxq_data->log_strd_sz, + .single_wqe_log_num_of_strides = rxq_data->log_strd_num, .two_byte_shift_en =MLX5_MPRQ_TWO_BYTE_SHIFT , }; }
drivers/net/mlx5/mlx5.c +2 -2
@@ -1884,9 +1884,9 @@ mlx5_args_check(const char *key, const char *val, void *opaque) }else if (strcmp (MLX5_RX_MPRQ_EN , key) ==0 ) { config->mprq.enabled = !!tmp; }else if (strcmp (MLX5_RX_MPRQ_LOG_STRIDE_NUM , key) ==0 ) { - config->mprq.stride_num_n = tmp; + config->mprq.log_stride_num = tmp; }else if (strcmp (MLX5_RX_MPRQ_LOG_STRIDE_SIZE , key) ==0 ) { - config->mprq.stride_size_n = tmp; + config->mprq.log_stride_size = tmp; }else if (strcmp (MLX5_RX_MPRQ_MAX_MEMCPY_LEN , key) ==0 ) { config->mprq.max_memcpy_len = tmp; }else if (strcmp (MLX5_RXQS_MIN_MPRQ , key) ==0 ) {
drivers/net/mlx5/mlx5.h +4 -4
@@ -275,10 +275,10 @@ struct mlx5_dev_config { unsigned int hp_delay_drop:1; /* Enable hairpin Rxq delay drop. */struct {unsigned int enabled:1 ;/* Whether MPRQ is enabled. */ -unsigned int stride_num_n;/* Number of strides. */ -unsigned int stride_size_n;/* Size of a stride. */ -unsigned int min_stride_size_n;/* Min size of a stride. */ -unsigned int max_stride_size_n;/* Max size of a stride. */ +unsigned int log_stride_num;/* Log number of strides. */ +unsigned int log_stride_size;/* Log size of a stride. */ +unsigned int log_min_stride_size;/* Log min size of a stride.*/ +unsigned int log_max_stride_size;/* Log max size of a stride.*/ unsigned int max_memcpy_len;/* Maximum packet size to memcpy Rx packets. */ unsigned int min_rxqs_num;
drivers/net/mlx5/mlx5_defs.h +2 -2
@@ -113,10 +113,10 @@#define MLX5_UAR_PAGE_NUM_MASK ((MLX5_UAR_PAGE_NUM_MAX) - 1)/* Log 2 of the default number of strides per WQE for Multi-Packet RQ. */ -#define MLX5_MPRQ_STRIDE_NUM_N 6U +#define MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM 6U/* Log 2 of the default size of a stride per WQE for Multi-Packet RQ. */ -#define MLX5_MPRQ_STRIDE_SIZE_N 11U +#define MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE 11U/* Two-byte shift is disabled for Multi-Packet RQ. */ #define MLX5_MPRQ_TWO_BYTE_SHIFT 0
drivers/net/mlx5/mlx5_devx.c +2 -2
@@ -257,11 +257,11 @@ mlx5_rxq_create_devx_rq_resources(struct mlx5_rxq_priv *rxq)* 512*2^single_wqe_log_num_of_strides. */ rq_attr.wq_attr.single_wqe_log_num_of_strides = - rxq_data->strd_num_n - + rxq_data->log_strd_num -MLX5_MIN_SINGLE_WQE_LOG_NUM_STRIDES ;/* Stride size = (2^single_stride_log_num_of_bytes)*64B. */ rq_attr.wq_attr.single_stride_log_num_of_bytes = - rxq_data->strd_sz_n - + rxq_data->log_strd_sz -MLX5_MIN_SINGLE_STRIDE_LOG_NUM_BYTES ; wqe_size =sizeof (struct mlx5_wqe_mprq ); }else {
drivers/net/mlx5/mlx5_rx.c +11 -11
@@ -73,7 +73,7 @@ rx_queue_count(struct mlx5_rxq_data *rxq)const unsigned int cqe_n = (1 << rxq->cqe_n);const unsigned int sges_n = (1 << rxq->sges_n);const unsigned int elts_n = (1 << rxq->elts_n); -const unsigned int strd_n = (1 << rxq->strd_num_n); +const unsigned int strd_n =RTE_BIT32 (rxq->log_strd_num);const unsigned int cqe_cnt = cqe_n -1 ;unsigned int cq_ci, used;
@@ -167,8 +167,8 @@ mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, qinfo->conf.offloads = dev->data->dev_conf.rxmode.offloads; qinfo->scattered_rx = dev->data->scattered_rx; qinfo->nb_desc =mlx5_rxq_mprq_enabled (rxq) ? - (1 << rxq->elts_n) * (1 << rxq->strd_num_n) : - (1 << rxq->elts_n); +RTE_BIT32 (rxq->elts_n) *RTE_BIT32 (rxq->log_strd_num) : +RTE_BIT32 (rxq->elts_n); }/**
@@ -354,10 +354,10 @@ mlx5_rxq_initialize(struct mlx5_rxq_data *rxq) scat = &((volatile struct mlx5_wqe_mprq *) rxq->wqes)[i].dseg; - addr = (uintptr_t )mlx5_mprq_buf_addr (buf, -1 << rxq->strd_num_n); - byte_count = (1 << rxq->strd_sz_n) * - (1 << rxq->strd_num_n); + addr = (uintptr_t )mlx5_mprq_buf_addr + (buf,RTE_BIT32 (rxq->log_strd_num)); + byte_count =RTE_BIT32 (rxq->log_strd_sz) * +RTE_BIT32 (rxq->log_strd_num); lkey =mlx5_rx_addr2mr (rxq, addr); }else {struct rte_mbuf *buf = (*rxq->elts)[i];
@@ -383,7 +383,7 @@ mlx5_rxq_initialize(struct mlx5_rxq_data *rxq) .ai = 0, }; rxq->elts_ci =mlx5_rxq_mprq_enabled (rxq) ? - (wqe_n >> rxq->sges_n) * (1 << rxq->strd_num_n) :0 ; + (wqe_n >> rxq->sges_n) *RTE_BIT32 (rxq->log_strd_num) :0 ;/* Update doorbell counter. */ rxq->rq_ci = wqe_n >> rxq->sges_n;rte_io_wmb ();
@@ -412,7 +412,7 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec)const uint16_t cqe_n =1 << rxq->cqe_n;const uint16_t cqe_mask = cqe_n -1 ;const uint16_t wqe_n =1 << rxq->elts_n; -const uint16_t strd_n =1 << rxq->strd_num_n; +const uint16_t strd_n =RTE_BIT32 (rxq->log_strd_num);struct mlx5_rxq_ctrl *rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq);union {
@@ -1045,8 +1045,8 @@ uint16_t mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) {struct mlx5_rxq_data *rxq = dpdk_rxq; -const uint32_t strd_n =1 << rxq->strd_num_n; -const uint32_t strd_sz =1 << rxq->strd_sz_n; +const uint32_t strd_n =RTE_BIT32 (rxq->log_strd_num); +const uint32_t strd_sz =RTE_BIT32 (rxq->log_strd_sz);const uint32_t cq_mask = (1 << rxq->cqe_n) -1 ;const uint32_t wq_mask = (1 << rxq->elts_n) -1 ;volatile struct mlx5_cqe *cqe = &(*rxq->cqes)[rxq->cq_ci & cq_mask];
drivers/net/mlx5/mlx5_rx.h +6 -6
@@ -88,8 +88,8 @@ struct mlx5_rxq_data { unsigned int elts_n:4; /* Log 2 of Mbufs. */ unsigned int rss_hash:1; /* RSS hash result is enabled. */ unsigned int mark:1; /* Marked flow available on the queue. */ - unsigned int strd_num_n:5; /* Log 2 of the number of stride. */ - unsigned int strd_sz_n:4; /* Log 2 of stride size. */ + unsigned int log_strd_num:5; /* Log 2 of the number of stride. */ + unsigned int log_strd_sz:4; /* Log 2 of stride size. */ unsigned int strd_shift_en:1; /* Enable 2bytes shift on a stride. */ unsigned int err_state:2; /* enum mlx5_rxq_err_state. */ unsigned int strd_scatter_en:1; /* Scattered packets from a stride. */
@@ -395,7 +395,7 @@ mlx5_timestamp_set(struct rte_mbuf *mbuf, int offset, static __rte_always_inline voidmprq_buf_replace (struct mlx5_rxq_data *rxq,uint16_t rq_idx) { -const uint32_t strd_n =1 << rxq->strd_num_n; +const uint32_t strd_n =RTE_BIT32 (rxq->log_strd_num);struct mlx5_mprq_buf *rep = rxq->mprq_repl;volatile struct mlx5_wqe_data_seg *wqe = &((volatile struct mlx5_wqe_mprq *)rxq->wqes)[rq_idx].dseg;
@@ -453,8 +453,8 @@ static __rte_always_inline enum mlx5_rqx_code mprq_buf_to_pkt(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, uint32_t len, struct mlx5_mprq_buf *buf, uint16_t strd_idx, uint16_t strd_cnt) { - const uint32_t strd_n = 1 << rxq->strd_num_n; -const uint16_t strd_sz =1 << rxq->strd_sz_n; + const uint32_t strd_n = RTE_BIT32(rxq->log_strd_num); +const uint16_t strd_sz =RTE_BIT32 (rxq->log_strd_sz);const uint16_t strd_shift =MLX5_MPRQ_STRIDE_SHIFT_BYTE * rxq->strd_shift_en; const int32_t hdrm_overlap =
@@ -599,7 +599,7 @@ mlx5_check_mprq_support(struct rte_eth_dev *dev) static __rte_always_inline intmlx5_rxq_mprq_enabled (struct mlx5_rxq_data *rxq) { -return rxq->strd_num_n >0 ; +return rxq->log_strd_num >0 ; }/**
drivers/net/mlx5/mlx5_rxq.c +54 -48
182 lines not on this page · raw message
drivers/net/mlx5/mlx5_rxtx_vec.c +4 -4
@@ -148,7 +148,7 @@ static inline void mlx5_rx_mprq_replenish_bulk_mbuf(struct mlx5_rxq_data *rxq) {const uint16_t wqe_n =1 << rxq->elts_n; -const uint32_t strd_n =1 << rxq->strd_num_n; +const uint32_t strd_n =RTE_BIT32 (rxq->log_strd_num);const uint32_t elts_n = wqe_n * strd_n;const uint32_t wqe_mask = elts_n -1 ;uint32_t n = elts_n - (rxq->elts_ci - rxq->rq_pi);
@@ -197,8 +197,8 @@ rxq_copy_mprq_mbuf_v(struct mlx5_rxq_data *rxq, {const uint16_t wqe_n =1 << rxq->elts_n;const uint16_t wqe_mask = wqe_n -1 ; -const uint16_t strd_sz =1 << rxq->strd_sz_n; -const uint32_t strd_n =1 << rxq->strd_num_n; +const uint16_t strd_sz =RTE_BIT32 (rxq->log_strd_sz); +const uint32_t strd_n =RTE_BIT32 (rxq->log_strd_num);const uint32_t elts_n = wqe_n * strd_n;const uint32_t elts_mask = elts_n -1 ;uint32_t elts_idx = rxq->rq_pi & elts_mask;
@@ -428,7 +428,7 @@ rxq_burst_mprq_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts,const uint16_t q_n =1 << rxq->cqe_n;const uint16_t q_mask = q_n -1 ;const uint16_t wqe_n =1 << rxq->elts_n; -const uint32_t strd_n =1 << rxq->strd_num_n; +const uint32_t strd_n =RTE_BIT32 (rxq->log_strd_num);const uint32_t elts_n = wqe_n * strd_n;const uint32_t elts_mask = elts_n -1 ;volatile struct mlx5_cqe *cq;
Signature · 1 line
2.25.1
Re: [PATCH 2/3] net/mlx5: improve stride parameter names
Quoted 5 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
In the striding RQ management there are two important parameters, the size of the single stride in bytes and the number of strides.
Quoted 9 lines
Both the data-path structure and config structure keep the log of the above parameters. However, in their names there is no mention that the value is a log which may be misleading as if the fields represent the values themselves.
This patch updates their names describing the values more accurately.
Can you please provide fixes tag for it?
In this case commit(s) adding the parameters with bad name.
Quoted 2 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>
RE: [PATCH 2/3] net/mlx5: improve stride parameter names
Quoted 12 lines · On 12/07/2021 3:34 PM, [email protected] wrote:
Quoted 10 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
In the striding RQ management there are two important parameters, the size of the single stride in bytes and the number of strides.
Both the data-path structure and config structure keep the log of the above parameters. However, in their names there is no mention that the value is a log which may be misleading as if the fields represent the values themselves.
Quoted 6 lines
Quoted 4 lines
This patch updates their names describing the values more accurately.
Can you please provide fixes tag for it?
I think this is the relevant fixes tag:
Quoted 1 line
In this case commit(s) adding the parameters with bad name.
I added Cc:stable here just to make next commit easy for the backport, because following patch is based on it.
For this commit itself there is no reason backporting it ,because it does not solve something that affects the user but prevents confusion from future programmers.
Quoted 3 lines
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>
PATCH 3/3 net/mlx5: fix missing adjustment MPRQ stride devargs
In reply to [email protected]From: Michael Baum <[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.
If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
This patch adds an adjustment in these cases as well. When the user selects values whose multiplication is lower than the minimum, they are replaced with the default values.
--- drivers/net/mlx5/linux/mlx5_os.c | 56 +++------ drivers/net/mlx5/mlx5.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 209 +++++++++++++++++++++---------- 3 files changed, 159 insertions(+), 110 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +15 -41
@@ -881,10 +881,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,unsigned int mpls_en =0 ;unsigned int swp =0 ;unsigned int mprq =0 ; -unsigned int mprq_min_stride_size_n =0 ; -unsigned int mprq_max_stride_size_n =0 ; -unsigned int mprq_min_stride_num_n =0 ; -unsigned int mprq_max_stride_num_n =0 ;struct rte_ether_addr mac;char name[RTE_ETH_NAME_MAX_LEN ];int own_domain_id =0 ;
@@ -1039,15 +1035,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mprq_caps.max_single_wqe_log_num_of_strides);DRV_LOG (DEBUG ,"\tsupported_qpts: %d" , mprq_caps.supported_qpts); +DRV_LOG (DEBUG ,"\tmin_stride_wqe_log_size: %d" , + config->mprq.log_min_stride_wqe_size);DRV_LOG (DEBUG ,"device supports Multi-Packet RQ" ); mprq =1 ; - mprq_min_stride_size_n = + config->mprq.log_min_stride_size = mprq_caps.min_single_stride_log_num_of_bytes; - mprq_max_stride_size_n = + config->mprq.log_max_stride_size = mprq_caps.max_single_stride_log_num_of_bytes; - mprq_min_stride_num_n = + config->mprq.log_min_stride_num = mprq_caps.min_single_wqe_log_num_of_strides; - mprq_max_stride_num_n = + config->mprq.log_max_stride_num = mprq_caps.max_single_wqe_log_num_of_strides; }#endif
@@ -1548,36 +1546,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, config->hw_fcs_strip =0 ;DRV_LOG (DEBUG ,"FCS stripping configuration is %ssupported" , (config->hw_fcs_strip ?"" :"not " )); -if (config->mprq.enabled && mprq) { -if (config->mprq.log_stride_num && - (config->mprq.log_stride_num > mprq_max_stride_num_n || - config->mprq.log_stride_num < mprq_min_stride_num_n)) { - config->mprq.log_stride_num = -RTE_MIN (RTE_MAX (MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM , - mprq_min_stride_num_n), - mprq_max_stride_num_n); -DRV_LOG (WARNING , -"the number of strides" -" for Multi-Packet RQ is out of range," -" setting default value (%u)" , -1 << config->mprq.log_stride_num); - } -if (config->mprq.log_stride_size && - (config->mprq.log_stride_size > mprq_max_stride_size_n || - config->mprq.log_stride_size < mprq_min_stride_size_n)) { - config->mprq.log_stride_size = -RTE_MIN (RTE_MAX (MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE , - mprq_min_stride_size_n), - mprq_max_stride_size_n); -DRV_LOG (WARNING , -"the size of a stride" -" for Multi-Packet RQ is out of range," -" setting default value (%u)" , -1 << config->mprq.log_stride_size); - } - config->mprq.log_min_stride_size = mprq_min_stride_size_n; - config->mprq.log_max_stride_size = mprq_max_stride_size_n; - }else if (config->mprq.enabled && !mprq) { +if (config->mprq.enabled && !mprq) {DRV_LOG (WARNING ,"Multi-Packet RQ isn't supported" ); config->mprq.enabled =0 ; }
@@ -2068,7 +2037,8 @@ mlx5_device_bond_pci_match(const char *ibdev_name, }static void -mlx5_os_config_default (struct mlx5_dev_config *config) +mlx5_os_config_default (struct mlx5_dev_config *config, +struct mlx5_common_dev_config *cconf) {memset (config,0 ,sizeof (*config)); config->mps =MLX5_ARG_UNSET ;
@@ -2080,6 +2050,10 @@ mlx5_os_config_default(struct mlx5_dev_config *config) config->vf_nl_en =1 ; config->mprq.max_memcpy_len =MLX5_MPRQ_MEMCPY_DEFAULT_LEN ; config->mprq.min_rxqs_num =MLX5_MPRQ_MIN_RXQS ; + config->mprq.log_min_stride_wqe_size = cconf->devx ? + cconf->hca_attr.log_min_stride_wqe_sz : +MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE ; + config->mprq.log_stride_num =MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM ; config->dv_esw_en =1 ; config->dv_flow_en =1 ; config->decap_en =1 ;
@@ -2496,7 +2470,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,uint32_t restore;/* Default configuration. */ -mlx5_os_config_default (&dev_config); +mlx5_os_config_default (&dev_config, &cdev->config); dev_config.vf = dev_config_vf; list[i].eth_dev =mlx5_dev_spawn (cdev->dev, &list[i], &dev_config, ð_da);
@@ -2666,7 +2640,7 @@ mlx5_os_auxiliary_probe(struct mlx5_common_device *cdev)if (ret !=0 )return ret;/* Set default config data. */ -mlx5_os_config_default (&config); +mlx5_os_config_default (&config, &cdev->config); config.sf =1 ;/* Init spawn data. */ spawn.max_port =1 ;
drivers/net/mlx5/mlx5.h +4 -0
@@ -279,6 +279,10 @@ struct mlx5_dev_config {unsigned int log_stride_size;/* Log size of a stride. */ unsigned int log_min_stride_size;/* Log min size of a stride.*/ unsigned int log_max_stride_size;/* Log max size of a stride.*/ +unsigned int log_min_stride_num;/* Log min num of strides. */ +unsigned int log_max_stride_num;/* Log max num of strides. */ +unsigned int log_min_stride_wqe_size; +/* Log min WQE size, (size of single stride)*(num of strides).*/ unsigned int max_memcpy_len;/* Maximum packet size to memcpy Rx packets. */ unsigned int min_rxqs_num;
drivers/net/mlx5/mlx5_rxq.c +140 -69
261 lines not on this page · raw message
Signature · 1 line
2.25.1
RE: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
Hi,
Quoted 235 lines
-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Tuesday, November 23, 2021 8:38 PM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Michael Baum <[email protected]>; [email protected]
Subject: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargsFrom: Michael Baum <[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
This patch adds an adjustment in these cases as well. When the user selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stridesize")
Cc: [email protected]Signed-off-by Michael Baum <[email protected]>Acked-by Matan Azrad <[email protected]>--- drivers/net/mlx5/linux/mlx5_os.c | 56 +++------ drivers/net/mlx5/mlx5.h | 4 + drivers/net/mlx5/mlx5_rxq.c | 209 +++++++++++++++++++++---------- 3 files changed, 159 insertions(+), 110 deletions(-)drivers/net/mlx5/linux/mlx5_os.c +6
-11@@ -881,10 +881,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,unsigned int mpls_en =0 ;unsigned int swp =0 ;unsigned int mprq =0 ; -unsigned int mprq_min_stride_size_n =0 ; -unsigned int mprq_max_stride_size_n =0 ; -unsigned int mprq_min_stride_num_n =0 ; -unsigned int mprq_max_stride_num_n =0 ;struct rte_ether_addr mac;char name[RTE_ETH_NAME_MAX_LEN ];int own_domain_id =0 ;@@ -1039,15 +1035,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, mprq_caps.max_single_wqe_log_num_of_strides);DRV_LOG (DEBUG ,"\tsupported_qpts: %d" , mprq_caps.supported_qpts); +DRV_LOG (DEBUG ,"\tmin_stride_wqe_log_size: %d" , + config->mprq.log_min_stride_wqe_size);DRV_LOG (DEBUG ,"device supports Multi-Packet RQ" ); mprq =1 ; - mprq_min_stride_size_n = + config->mprq.log_min_stride_size = mprq_caps.min_single_stride_log_num_of_bytes; - mprq_max_stride_size_n = + config->mprq.log_max_stride_size = mprq_caps.max_single_stride_log_num_of_bytes; - mprq_min_stride_num_n = + config->mprq.log_min_stride_num = mprq_caps.min_single_wqe_log_num_of_strides; - mprq_max_stride_num_n = + config->mprq.log_max_stride_num = mprq_caps.max_single_wqe_log_num_of_strides; }#endif @@ -1548,36 +1546,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, config->hw_fcs_strip =0 ;DRV_LOG (DEBUG ,"FCS stripping configuration is %ssupported" , (config->hw_fcs_strip ?"" :"not " )); -if (config->mprq.enabled && mprq) { - if (config->mprq.log_stride_num && - (config->mprq.log_stride_num >
mprq_max_stride_num_n||drivers/net/mlx5/linux/mlx5_os.c +0
-1- config->mprq.log_stride_num <
mprq_min_stride_num_n)) {drivers/net/mlx5/linux/mlx5_os.c +0
-2- config->mprq.log_stride_num = -RTE_MIN(RTE_MAX(MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM,
drivers/net/mlx5/linux/mlx5_os.c +0
-10- mprq_min_stride_num_n), - mprq_max_stride_num_n); -DRV_LOG (WARNING , -"the number of strides" -" for Multi-Packet RQ is out of range," -" setting default value (%u)" , -1 << config->mprq.log_stride_num); - } - if (config->mprq.log_stride_size && - (config->mprq.log_stride_size > mprq_max_stride_size_n||
drivers/net/mlx5/linux/mlx5_os.c +0
-1- config->mprq.log_stride_size < mprq_min_stride_size_n)){
drivers/net/mlx5/linux/mlx5_os.c +0
-2- config->mprq.log_stride_size = -RTE_MIN(RTE_MAX(MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE,
drivers/net/mlx5/linux/mlx5_os.c +0
-9- mprq_min_stride_size_n), - mprq_max_stride_size_n); -DRV_LOG (WARNING , -"the size of a stride" -" for Multi-Packet RQ is out of range," -" setting default value (%u)" , -1 << config->mprq.log_stride_size); - } - config->mprq.log_min_stride_size =
mprq_min_stride_size_n;drivers/net/mlx5/linux/mlx5_os.c +0
-1- config->mprq.log_max_stride_size =
mprq_max_stride_size_n;drivers/net/mlx5/linux/mlx5_os.c +5
-2- }else if (config->mprq.enabled && !mprq) { +if (config->mprq.enabled && !mprq) {DRV_LOG (WARNING ,"Multi-Packet RQ isn't supported" ); config->mprq.enabled =0 ; }@@ -2068,7 +2037,8 @@ mlx5_device_bond_pci_match(const char *ibdev_name, }static void -mlx5_os_config_default (struct mlx5_dev_config *config) +mlx5_os_config_default (struct mlx5_dev_config *config, +struct mlx5_common_dev_config *cconf) {memset (config,0 ,sizeof (*config)); config->mps =MLX5_ARG_UNSET ;@@ -2080,6 +2050,10 @@ mlx5_os_config_default(struct mlx5_dev_config *config) config->vf_nl_en =1 ; config->mprq.max_memcpy_len =MLX5_MPRQ_MEMCPY_DEFAULT_LEN ; config->mprq.min_rxqs_num =MLX5_MPRQ_MIN_RXQS ; + config->mprq.log_min_stride_wqe_size = cconf->devx ? + cconf-Quoted 1 line
hca_attr.log_min_stride_wqe_sz :
+
MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE;drivers/net/mlx5/linux/mlx5_os.c +1
-0+ config->mprq.log_stride_num =
MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM;drivers/net/mlx5/linux/mlx5_os.c +1
-1config->dv_esw_en =1 ; config->dv_flow_en =1 ; config->decap_en =1 ;@@ -2496,7 +2470,7 @@ mlx5_os_pci_probe_pf(structmlx5_common_device *cdev, uint32_t restore;/* Default configuration. */ -mlx5_os_config_default (&dev_config); +mlx5_os_config_default (&dev_config, &cdev->config); dev_config.vf = dev_config_vf; list[i].eth_dev = mlx5_dev_spawn(cdev->dev, &list[i],drivers/net/mlx5/linux/mlx5_os.c +1
-1&dev_config, ð_da);@@ -2666,7 +2640,7 @@ mlx5_os_auxiliary_probe(struct mlx5_common_device *cdev)if (ret !=0 )return ret;/* Set default config data. */ -mlx5_os_config_default (&config); +mlx5_os_config_default (&config, &cdev->config); config.sf =1 ;/* Init spawn data. */ drivers/net/mlx5/linux/mlx5_os.c +0
-0spawn.max_port =1 ;drivers/net/mlx5/mlx5.h index renamed from drivers/net/mlx5/mlx5.h +0
-0
4ba90db816..c01fb9566e100644drivers/net/mlx5/mlx5.h +0
-0@@ -279,6 +279,10 @@ struct mlx5_dev_config {unsigned int log_stride_size;/* Log size of a stride. */ unsigned int log_min_stride_size;/* Log min size of a stride.*/
unsigned intlog_max_stride_size; /* Log max size of a
stride.*/drivers/net/mlx5/mlx5.h +1
-0+unsigned int log_min_stride_num;/* Log min num of strides. */
drivers/net/mlx5/mlx5.h +1
-0+unsigned int log_max_stride_num;/* Log max num of strides. */
drivers/net/mlx5/mlx5.h +2
-0+unsigned int log_min_stride_wqe_size; +/* Log min WQE size, (size of single stride)*(num of strides).*/
drivers/net/mlx5/mlx5.h +0
-0unsigned int max_memcpy_len;/* Maximum packet size to memcpy Rx packets. */ unsigned int min_rxqs_num;drivers/net/mlx5/mlx5_rxq.c +36
-0@@ -1528,6 +1528,126 @@ mlx5_max_lro_msg_size_adjust(struct rte_eth_dev *dev, uint16_t idx, priv->max_lro_msg_size * MLX5_LRO_SEG_CHUNK_SIZE); } +/** +* Prepare both size and number of stride for Multi-Packet RQ. +* +* @param dev +* Pointer to Ethernet device. +* @param idx +* RX queue index. +* @param desc +* Number of descriptors to configure in queue. +* @param rx_seg_en +* Indicator if Rx segment enables, if so Multi-Packet RQ doesn't enable. +* @param min_mbuf_size +* Non scatter min mbuf size, max_rx_pktlen plus overhead. +* @param actual_log_stride_num +* Log number of strides to configure for this queue. +* @param actual_log_stride_size +* Log stride size to configure for this queue. +* +* @return +* 0 if Multi-Packet RQ is supported, otherwise -1. +*/ +static int +mlx5_mprq_prepare (struct rte_eth_dev *dev,uint16_t idx,uint16_t desc, +bool rx_seg_en,uint32_t min_mbuf_size, +uint32_t *actual_log_stride_num, +uint32_t *actual_log_stride_size) +{ +struct mlx5_priv *priv = dev->data->dev_private; +struct mlx5_dev_config *config = &priv->config; +uint32_t log_min_stride_num = config->mprq.log_min_stride_num; +uint32_t log_max_stride_num = config->mprq.log_max_stride_num; +uint32_t log_def_stride_num = +RTE_MIN (RTE_MAX (MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM , + log_min_stride_num), + log_max_stride_num); +uint32_t log_min_stride_size = config->mprq.log_min_stride_size;
drivers/net/mlx5/mlx5_rxq.c mlx5_max_lro_msg_size_adjust(struct · line 1577
Quoted 10 lines
drivers/net/mlx5/mlx5_rxq.c +9
-0+uint32_t log_max_stride_size = config->mprq.log_max_stride_size; +uint32_t log_def_stride_size = +RTE_MIN (RTE_MAX (MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE , + log_min_stride_size), + log_max_stride_size); +uint32_t log_stride_wqe_size; + +if (mlx5_check_mprq_support (dev) !=1 || rx_seg_en) + goto unsupport;
typo in this label name, will fix during integration. [..]
Kindest regards
Raslan Darawsheh
Re: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
In reply to [email protected]Quoted 3 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides
Multi-Packet ?
Quoted 11 lines
and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
Quoted 7 lines
Quoted 1 line
This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stride size")
Again, not sure if we can backport this patch, this looks a behavior change more than a fix.
Previously if the user provided values ends up being invalid, PMD seems returning error.
With this patch, instead of returning error PMD prefers to use default values and doesn't return error.
I am not sure if it is correct thing to ignore (adjust) user provided values, but that can be up to the PMD as long as the behavior is documented.
But I think it is wrong to backport the behavior change.
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>---
RE: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
Quoted 7 lines · On 12/07/2021 3:41 PM, [email protected] wrote:
Quoted 3 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides
Multi-Packet ?
Yes, you're right. It should have been Multi-Packet, thank you for that.
Quoted 20 lines
Quoted 12 lines
and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
Quoted 7 lines
Quoted 1 line
This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stridesize") Cc:[email protected]
Quoted 7 lines
Again, not sure if we can backport this patch, this looks a behavior change more than a fix.
Previously if the user provided values ends up being invalid, PMD seems returning error.
With this patch, instead of returning error PMD prefers to use default values and doesn't return error.
It isn't behavior change.
It existed before, except that it is concentrated into one function.
Quoted 3 lines
I am not sure if it is correct thing to ignore (adjust) user provided values, but that can be up to the PMD as long as the behavior is documented.
Adjustment is the likely thing to do because the range depends on the device and the user does not necessarily know it.
This behavior is documented here https://doc.dpdk.org/guides/nics/mlx5.html#run-time-configuration (Run-time configuration -> Driver options -> mprq_log_stride_num/size)
Quoted 6 lines
But I think it is wrong to backport the behavior change.
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>---
Re: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
Quoted 44 lines · Michael Baum
Quoted 7 lines · On 12/07/2021 3:41 PM, [email protected] wrote:
Quoted 3 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
From: Michael Baum<[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides
Multi-Packet ?
Yes, you're right. It should have been Multi-Packet, thank you for that.
Quoted 20 lines
Quoted 12 lines
and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
Quoted 7 lines
Quoted 1 line
This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stridesize") Cc:[email protected]
Quoted 7 lines
Again, not sure if we can backport this patch, this looks a behavior change more than a fix.
Previously if the user provided values ends up being invalid, PMD seems returning error.
With this patch, instead of returning error PMD prefers to use default values and doesn't return error.It isn't behavior change.
It existed before, except that it is concentrated into one function.Quoted 1 line
Quoted 6 lines
Quoted 2 lines
I am not sure if it is correct thing to ignore (adjust) user provided values, but that can be up to the PMD as long as the behavior is documented.
Adjustment is the likely thing to do because the range depends on the device and the user does not necessarily know it.
This behavior is documented here https://doc.dpdk.org/guides/nics/mlx5.html#run-time-configuration (Run-time configuration -> Driver options -> mprq_log_stride_num/size)
It is documented that adjustments will be done if any specific argument is not in the range of the device capability.
It is not clear what will happen if the calculated value from both variables are not valid.
If it is not documented before, and previously it was returning error, now adjusting values to make it work looks like behavior change to me.
This is more of a process question, than technical detail in the driver, so @Luca, @Kevin, @Christian, can you please comment? I will follow your suggestion.
Quoted 7 lines
Quoted 6 lines
But I think it is wrong to backport the behavior change.
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>---
RE: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
Hi Ferruh
Thanks for the review.
Please see inside some clarifications.
From: Ferruh Yigit
Quoted 57 lines · Michael Baum
Quoted 36 lines · On 12/07/2021 3:41 PM, [email protected] wrote:
Quoted 8 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
Quoted 4 lines
From: Michael Baum<[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides
Multi-Packet ?
Yes, you're right. It should have been Multi-Packet, thank you for that.
Quoted 23 lines
Quoted 12 lines
and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
Quoted 7 lines
Quoted 1 line
This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stridesize") Cc:[email protected]
Again, not sure if we can backport this patch, this looks a behavior change more than a fix.
Quoted 11 lines
Quoted 4 lines
Previously if the user provided values ends up being invalid, PMD seems returning error.
With this patch, instead of returning error PMD prefers to use default values and doesn't return error.It isn't behavior change.
It existed before, except that it is concentrated into one function.Quoted 3 lines
I am not sure if it is correct thing to ignore (adjust) user provided values, but that can be up to the PMD as long as the behavior is
documented.
Quoted 2 lines
Adjustment is the likely thing to do because the range depends on the
device and the user does not necessarily know it.
Quoted 4 lines
This behavior is documented here
https://doc.dpdk.org/guides/nics/mlx5.html#run-time-configuration
(Run-time configuration -> Driver options -> mprq_log_stride_num/size)
Quoted 5 lines
It is documented that adjustments will be done if any specific argument is not in the range of the device capability.
It is not clear what will happen if the calculated value from both variables are not valid.
The driver should adjust it to a legal value.
Quoted 2 lines
If it is not documented before, and previously it was returning error, now adjusting values to make it work looks like behavior change to me.
The driver should not return an error - the driver should adjust to a legal value in case of illegal values by the user. It is documented in the devargs description.
Not behavior change but a bug fix; previously, the adjustment may return an error(which is a bug) or cause unexpected behavior in the HW(which is an old FW bug). Now, no error, no unexpected behavior - bug should be fixed for any FW version.
Quoted 12 lines
This is more of a process question, than technical detail in the driver, so @Luca, @Kevin, @Christian, can you please comment? I will follow your suggestion.
Quoted 7 lines
Quoted 6 lines
But I think it is wrong to backport the behavior change.
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>---
Re: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
Quoted 72 lines · Matan Azrad
Hi Ferruh
Thanks for the review.
Please see inside some clarifications.
From: Ferruh Yigit
Quoted 57 lines · Michael Baum
Quoted 36 lines · On 12/07/2021 3:41 PM, [email protected] wrote:
Quoted 8 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
Quoted 4 lines
From: Michael Baum<[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides
Multi-Packet ?
Yes, you're right. It should have been Multi-Packet, thank you for that.
Quoted 23 lines
Quoted 12 lines
and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
Quoted 7 lines
Quoted 1 line
This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stridesize") Cc:[email protected]
Again, not sure if we can backport this patch, this looks a behavior change more than a fix.
Quoted 11 lines
Quoted 4 lines
Previously if the user provided values ends up being invalid, PMD seems returning error.
With this patch, instead of returning error PMD prefers to use default values and doesn't return error.It isn't behavior change.
It existed before, except that it is concentrated into one function.Quoted 3 lines
I am not sure if it is correct thing to ignore (adjust) user provided values, but that can be up to the PMD as long as the behavior is
documented.
Quoted 2 lines
Adjustment is the likely thing to do because the range depends on the
device and the user does not necessarily know it.
Quoted 4 lines
This behavior is documented here
https://doc.dpdk.org/guides/nics/mlx5.html#run-time-configuration
(Run-time configuration -> Driver options -> mprq_log_stride_num/size)Quoted 5 lines
It is documented that adjustments will be done if any specific argument is not in the range of the device capability.
It is not clear what will happen if the calculated value from both variables are not valid.
The driver should adjust it to a legal value.
Quoted 9 lines
Quoted 2 lines
If it is not documented before, and previously it was returning error, now adjusting values to make it work looks like behavior change to me.
The driver should not return an error - the driver should adjust to a legal value in case of illegal values by the user. It is documented in the devargs description.
Not behavior change but a bug fix; previously, the adjustment may return an error(which is a bug) or cause unexpected behavior in the HW(which is an old FW bug). Now, no error, no unexpected behavior - bug should be fixed for any FW version.
I can understand both arguments. It is a behaviour change as the user will see a different behaviour for a given set of values.
However, each parameter is already validated and defaults are provided as backup. The combination not being checked could be seen a piece of missed validation for those values and a bug. In this case, given it is unlikely any user would be happy with the WQE creation failure, i think it is ok to backport the missing validation/adjustment.
Quoted 4 lines
Quoted 4 lines
This is more of a process question, than technical detail in the driver, so @Luca, @Kevin, @Christian, can you please comment? I will follow your suggestion.
Thanks for raising it Ferruh.
Kevin.
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
But I think it is wrong to backport the behavior change.
Quoted 3 lines
Signed-off-by Michael Baum<[email protected]>Acked-by Matan Azrad<[email protected]>---
Re: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs
Quoted 85 lines · Kevin Traynor
Quoted 72 lines · Matan Azrad
Hi Ferruh
Thanks for the review.
Please see inside some clarifications.
From: Ferruh Yigit
Quoted 57 lines · Michael Baum
Quoted 36 lines · On 12/07/2021 3:41 PM, [email protected] wrote:
Quoted 8 lines · On 11/23/2021 6:38 PM, [email protected] wrote:
Quoted 4 lines
From: Michael Baum<[email protected]>
In Multy-Packet RQ creation, the user can choose the number of strides
Multi-Packet ?
Yes, you're right. It should have been Multi-Packet, thank you for that.
Quoted 23 lines
Quoted 12 lines
and their size in bytes. The user updates it using specific devargs for both of these parameters.
The above two parameters determine the size of the WQE which is actually their product of multiplication.If the user selects values that are not in the supported range, the PMD changes them to default values. However, apart from the range limitations for each parameter individually there is also a minimum value on their multiplication. When the user selects values that their multiplication are lower than minimum value, no adjustment is made and the creation of the WQE fails.
Quoted 7 lines
Quoted 1 line
This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are replaced with the default values.
Fixes ecb160456aed ("net/mlx5: add device parameter for MPRQ stridesize") Cc:[email protected]
Again, not sure if we can backport this patch, this looks a behavior change more than a fix.
Quoted 11 lines
Quoted 4 lines
Previously if the user provided values ends up being invalid, PMD seems returning error.
With this patch, instead of returning error PMD prefers to use default values and doesn't return error.It isn't behavior change.
It existed before, except that it is concentrated into one function.Quoted 3 lines
I am not sure if it is correct thing to ignore (adjust) user provided values, but that can be up to the PMD as long as the behavior is
documented.
Quoted 2 lines
Adjustment is the likely thing to do because the range depends on the
device and the user does not necessarily know it.
Quoted 4 lines
This behavior is documented here
https://doc.dpdk.org/guides/nics/mlx5.html#run-time-configuration
(Run-time configuration -> Driver options -> mprq_log_stride_num/size)Quoted 5 lines
It is documented that adjustments will be done if any specific argument is not in the range of the device capability.
It is not clear what will happen if the calculated value from both variables are not valid.
The driver should adjust it to a legal value.
Quoted 9 lines
Quoted 2 lines
If it is not documented before, and previously it was returning error, now adjusting values to make it work looks like behavior change to me.
The driver should not return an error - the driver should adjust to a legal value in case of illegal values by the user. It is documented in the devargs description.
Not behavior change but a bug fix; previously, the adjustment may return an error(which is a bug) or cause unexpected behavior in the HW(which is an old FW bug). Now, no error, no unexpected behavior - bug should be fixed for any FW version.
I can understand both arguments. It is a behaviour change as the user will see a different behaviour for a given set of values.
Quoted 9 lines
However, each parameter is already validated and defaults are provided as backup. The combination not being checked could be seen a piece of missed validation for those values and a bug. In this case, given it is unlikely any user would be happy with the WQE creation failure, i think it is ok to backport the missing validation/adjustment.
Quoted 4 lines
Quoted 4 lines
This is more of a process question, than technical detail in the driver, so @Luca, @Kevin, @Christian, can you please comment? I will follow your suggestion.
Thanks for raising it Ferruh.
Proceeding with patch then, updated fixes tag for 2/3 in next-net.
Hi,
Quoted 33 lines
-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Tuesday, November 23, 2021 8:38 PM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Michael Baum <[email protected]>
Subject: [PATCH 0/3] fix MPRQ prepareFrom: Michael Baum <[email protected]>
Prepare Multy-Packet RQ and fix missing devargs check.
Michael Baum (3):
common/mlx5: add min WQE size for striding RQ net/mlx5: improve stride parameter names net/mlx5: fix missing adjustment MPRQ stride devargsdrivers/common/mlx5/mlx5_devx_cmds.c | 16 ++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 11 +- drivers/net/mlx5/linux/mlx5_os.c | 56 ++---- drivers/net/mlx5/linux/mlx5_verbs.c | 4 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 12 +- drivers/net/mlx5/mlx5_defs.h | 4 +- drivers/net/mlx5/mlx5_devx.c | 4 +- drivers/net/mlx5/mlx5_rx.c | 22 +-- drivers/net/mlx5/mlx5_rx.h | 12 +- drivers/net/mlx5/mlx5_rxq.c | 247 ++++++++++++++++++--------- drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +- 13 files changed, 240 insertions(+), 161 deletions(-)
Quoted 2 lines
--
2.25.1
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh