Re: [PATCH v1 7/9] test/bbdev: check assumptions on fft window
Hi Nicolas, On 6/20/24 20:11, Chautru, Nicolas wrote: Hi Maxime, -Original Message- From: Maxime Coquelin Sent: Wednesday, June 12, 2024 4:11 AM To: Vargas, Hernan ; dev@dpdk.org; gak...@marvell.com; t...@redhat.com Cc: Chautru, Nicolas ; Zhang, Qi Z Subject: Re: [PATCH v1 7/9] test/bbdev: check assumptions on fft window On 4/22/24 21:07, Hernan Vargas wrote: Add check for FFT window width. Signed-off-by: Hernan Vargas --- app/test-bbdev/test_bbdev_perf.c | 26 ++ app/test-bbdev/test_bbdev_vector.c | 14 ++ app/test-bbdev/test_bbdev_vector.h | 2 ++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 28d78e73a9c1..57b21730cab2 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -106,6 +106,8 @@ static int ldpc_llr_decimals; static int ldpc_llr_size; /* Keep track of the LDPC decoder device capability flag */ static uint32_t ldpc_cap_flags; +/* FFT window width predefined on device and on vector. */ static int +fft_window_width_dev; /* Represents tested active devices */ static struct active_device { @@ -881,6 +883,13 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info, rte_bbdev_info_get(dev_id, info); if (info->drv.device_status == RTE_BBDEV_DEV_FATAL_ERR) printf("Device Status %s\n", rte_bbdev_device_status_str(info->drv.device_status)); + if (info->drv.fft_window_width != NULL) + fft_window_width_dev = info->drv.fft_window_width[0]; + else + fft_window_width_dev = 0; + if (fft_window_width_dev != 0) + printf(" FFT Window0 width %d\n", fft_window_width_dev); Why not print the value systematically? It would only be zero if the application was not able to get that information, hence that would be irrelevant. Ok, please send a V2 addressing my request on patch 2 so that I can apply the series this week. Thanks, Maxime + nb_queues = RTE_MIN(rte_lcore_count(), info- drv.max_num_queues); nb_queues = RTE_MIN(nb_queues, (unsigned int) MAX_QUEUES); @@ -2583,7 +2592,8 @@ validate_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n, } static inline int -validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op) +validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op, + bool skip_validate_output) { struct rte_mbuf *m = op->data; uint8_t i, nb_dst_segments = orig_op->nb_segments; @@ -2613,7 +2623,7 @@ validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig abs_delt = delt > 0 ? delt : -delt; error_num += (abs_delt > thres_hold ? 1 : 0); } - if (error_num > 0) { + if ((error_num > 0) && !skip_validate_output) { rte_memdump(stdout, "Buffer A", ref_out, data_len); rte_memdump(stdout, "Buffer B", op_out, data_len); TEST_ASSERT(error_num == 0, @@ -2686,16 +2696,24 @@ validate_fft_op(struct rte_bbdev_fft_op **ops, const uint16_t n, int ret; struct op_data_entries *fft_data_orig = &test_vector.entries[DATA_HARD_OUTPUT]; struct op_data_entries *fft_pwr_orig = &test_vector.entries[DATA_SOFT_OUTPUT]; + bool skip_validate_output = false; + + if ((test_vector.fft_window_width_vec > 0) && + (test_vector.fft_window_width_vec != fft_window_width_dev)) { + printf("The vector FFT width doesn't match with device - skip %d %d\n", + test_vector.fft_window_width_vec, fft_window_width_dev); + skip_validate_output = true; + } for (i = 0; i < n; ++i) { ret = check_fft_status_and_ordering(ops[i], i, ref_op->status); TEST_ASSERT_SUCCESS(ret, "Checking status and ordering for FFT failed"); TEST_ASSERT_SUCCESS(validate_op_fft_chain( - &ops[i]->fft.base_output, fft_data_orig), + &ops[i]->fft.base_output, fft_data_orig, skip_validate_output), "FFT Output buffers (op=%u) are not matched", i); if (check_bit(ops[i]->fft.op_flags, RTE_BBDEV_FFT_POWER_MEAS)) TEST_ASSERT_SUCCESS(validate_op_fft_chain( - &ops[i]->fft.power_meas_output, fft_pwr_orig), + &ops[i]->fft.power_meas_output, fft_pwr_orig, +skip_validate_output), "FFT Power Output buffers (op=%u) are not matched", i); } diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index b3e9d4bb7504..e48947b211ac 100644
[PATCH 1/6] net/cnxk: stale offload flag reset
From: Amit Prakash Shukla mbuf buffer is not reset on tx and hence few fields has stale data from previous packets. Due to stale offload flags, in one of the scenarios with OVS, VxLAN offload flag was set while packet did not have the VxLAN header. In the OVS packet path, the flag was read and accordingly VxLAN processing was done but as packet did not have VxLAN header it caused segfault. This patch resets mbuf offload flags in rx burst function. Signed-off-by: Amit Prakash Shukla --- drivers/net/cnxk/cnxk_eswitch_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c b/drivers/net/cnxk/cnxk_eswitch_rxtx.c index d57e32b091..0200392f2d 100644 --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c @@ -194,7 +194,7 @@ cnxk_eswitch_dev_rx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, mbuf->vlan_tci = rx->vtag0_tci; /* Populate RSS hash */ mbuf->hash.rss = cqe->tag; - mbuf->ol_flags |= RTE_MBUF_F_RX_RSS_HASH; + mbuf->ol_flags = RTE_MBUF_F_RX_RSS_HASH; pkts[pkt] = mbuf; roc_prefetch_store_keep(mbuf); plt_esw_dbg("Packet %d rec on queue %d esw qid %d hash %x mbuf %p vlan tci %d", -- 2.18.0
[PATCH 2/6] net/cnxk: add MTU set ops
From: Ankur Dwivedi Implement mtu set ops for representor ports Signed-off-by: Ankur Dwivedi --- drivers/net/cnxk/cnxk_rep.h | 1 + drivers/net/cnxk/cnxk_rep_ops.c | 34 - 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cnxk_rep.h b/drivers/net/cnxk/cnxk_rep.h index 9bdea47bd4..ad89649702 100644 --- a/drivers/net/cnxk/cnxk_rep.h +++ b/drivers/net/cnxk/cnxk_rep.h @@ -146,5 +146,6 @@ int cnxk_rep_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, unsigned int n); int cnxk_rep_xstats_get_names_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, struct rte_eth_xstat_name *xstats_names, unsigned int n); +int cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu); #endif /* __CNXK_REP_H__ */ diff --git a/drivers/net/cnxk/cnxk_rep_ops.c b/drivers/net/cnxk/cnxk_rep_ops.c index 8bcb689468..42fa90 100644 --- a/drivers/net/cnxk/cnxk_rep_ops.c +++ b/drivers/net/cnxk/cnxk_rep_ops.c @@ -821,6 +821,37 @@ cnxk_rep_xstats_get_names_by_id(__rte_unused struct rte_eth_dev *eth_dev, const return n; } +int +cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) +{ + struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(eth_dev); + uint32_t frame_size = mtu + CNXK_NIX_L2_OVERHEAD; + int rc = -EINVAL; + + /* Check if MTU is within the allowed range */ + if ((frame_size - RTE_ETHER_CRC_LEN) < NIX_MIN_HW_FRS) { + plt_err("MTU is lesser than minimum"); + goto exit; + } + + if ((frame_size - RTE_ETHER_CRC_LEN) > + ((uint32_t)roc_nix_max_pkt_len(&rep_dev->parent_dev->nix))) { + plt_err("MTU is greater than maximum"); + goto exit; + } + + frame_size -= RTE_ETHER_CRC_LEN; + + /* Set frame size on Rx */ + rc = roc_nix_mac_max_rx_len_set(&rep_dev->parent_dev->nix, frame_size); + if (rc) { + plt_err("Failed to max Rx frame length, rc=%d", rc); + goto exit; + } +exit: + return rc; +} + /* CNXK platform representor dev ops */ struct eth_dev_ops cnxk_rep_dev_ops = { .dev_infos_get = cnxk_rep_dev_info_get, @@ -844,5 +875,6 @@ struct eth_dev_ops cnxk_rep_dev_ops = { .xstats_reset = cnxk_rep_xstats_reset, .xstats_get_names = cnxk_rep_xstats_get_names, .xstats_get_by_id = cnxk_rep_xstats_get_by_id, - .xstats_get_names_by_id = cnxk_rep_xstats_get_names_by_id + .xstats_get_names_by_id = cnxk_rep_xstats_get_names_by_id, + .mtu_set = cnxk_rep_mtu_set }; -- 2.18.0
[PATCH 3/6] net/cnxk: add multi seg support in eswitch
From: Ankur Dwivedi Introducing multi segment support in eswitch driver to handle packets of varying sizes. Signed-off-by: Ankur Dwivedi --- drivers/net/cnxk/cnxk_eswitch.c | 2 +- drivers/net/cnxk/cnxk_eswitch_rxtx.c | 167 --- 2 files changed, 149 insertions(+), 20 deletions(-) diff --git a/drivers/net/cnxk/cnxk_eswitch.c b/drivers/net/cnxk/cnxk_eswitch.c index f420d01ef8..6b1bfdd476 100644 --- a/drivers/net/cnxk/cnxk_eswitch.c +++ b/drivers/net/cnxk/cnxk_eswitch.c @@ -455,7 +455,7 @@ cnxk_eswitch_txq_setup(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, uint1 memset(sq, 0, sizeof(struct roc_nix_sq)); sq->qid = qid; sq->nb_desc = nb_desc; - sq->max_sqe_sz = NIX_MAXSQESZ_W8; + sq->max_sqe_sz = NIX_MAXSQESZ_W16; if (sq->nb_desc >= CNXK_NIX_DEF_SQ_COUNT) sq->fc_hyst_bits = 0x1; diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c b/drivers/net/cnxk/cnxk_eswitch_rxtx.c index 0200392f2d..83a9c68a34 100644 --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c @@ -39,31 +39,105 @@ eswitch_nix_rx_nb_pkts(struct roc_nix_cq *cq, const uint64_t wdata, const uint32 } static inline void -nix_cn9k_xmit_one(uint64_t *cmd, void *lmt_addr, const plt_iova_t io_addr) +nix_cn9k_xmit_one(uint64_t *cmd, void *lmt_addr, const plt_iova_t io_addr, uint16_t segdw) { uint64_t lmt_status; do { - roc_lmt_mov(lmt_addr, cmd, 0); + roc_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw); lmt_status = roc_lmt_submit_ldeor(io_addr); } while (lmt_status == 0); } +static __rte_always_inline uint16_t +cnxk_eswitch_prepare_mseg(struct rte_mbuf *m, union nix_send_sg_s *sg, uint64_t *cmd, uint64_t len, + uint8_t off) +{ + union nix_send_sg_s l_sg; + struct rte_mbuf *m_next; + uint64_t nb_segs; + uint64_t *slist; + uint16_t segdw; + uint64_t dlen; + + l_sg.u = 0; + l_sg.ld_type = NIX_SENDLDTYPE_LDD; + l_sg.subdc = NIX_SUBDC_SG; + + dlen = m->data_len; + l_sg.u |= dlen; + len -= dlen; + nb_segs = m->nb_segs - 1; + m_next = m->next; + m->next = NULL; + slist = &cmd[off + 1]; + l_sg.segs = 1; + *slist = rte_mbuf_data_iova(m); + slist++; + m = m_next; + if (!m) + goto done; + + do { + uint64_t iova; + + m_next = m->next; + iova = rte_mbuf_data_iova(m); + dlen = m->data_len; + len -= dlen; + + nb_segs--; + m->next = NULL; + + *slist = iova; + /* Set the segment length */ + l_sg.u |= ((uint64_t)dlen << (l_sg.segs << 4)); + l_sg.segs += 1; + slist++; + if (l_sg.segs > 2 && nb_segs) { + sg->u = l_sg.u; + /* Next SG subdesc */ + sg = (union nix_send_sg_s *)slist; + l_sg.u = 0; + l_sg.ld_type = NIX_SENDLDTYPE_LDD; + l_sg.subdc = NIX_SUBDC_SG; + slist++; + } + m = m_next; + } while (nb_segs); +done: + /* Write the last subdc out */ + sg->u = l_sg.u; + segdw = (uint64_t *)slist - (uint64_t *)&cmd[off]; + /* Roundup extra dwords to multiple of 2 */ + segdw = (segdw >> 1) + (segdw & 0x1); + /* Default dwords */ + segdw += (off >> 1); + + return segdw; +} + uint16_t cnxk_eswitch_dev_tx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, struct rte_mbuf **pkts, uint16_t nb_xmit, const uint16_t flags) { struct roc_nix_sq *sq = &eswitch_dev->txq[qid].sqs; struct roc_nix_rq *rq = &eswitch_dev->rxq[qid].rqs; - uint64_t aura_handle, cmd[6], data = 0; uint16_t lmt_id, pkt = 0, nb_tx = 0; struct nix_send_ext_s *send_hdr_ext; struct nix_send_hdr_s *send_hdr; + uint64_t aura_handle, data = 0; uint16_t vlan_tci = qid; union nix_send_sg_s *sg; uintptr_t lmt_base, pa; int64_t fc_pkts, dw_m1; + uint64_t cmd_cn9k[16]; + struct rte_mbuf *m; rte_iova_t io_addr; + uint16_t segdw; + uint64_t *cmd; + uint64_t len; + uint8_t off; if (unlikely(eswitch_dev->txq[qid].state != CNXK_ESWITCH_QUEUE_STATE_STARTED)) return 0; @@ -78,9 +152,14 @@ cnxk_eswitch_dev_tx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, /* 2(HDR) + 2(EXT_HDR) + 1(SG) + 1(IOVA) = 6/2 - 1 = 2 */ dw_m1 = cn10k_nix_tx_ext_subs(flags) + 1; - memset(cmd, 0, sizeof(cmd)); + if (roc_model_is_cn9k()) { + memset(cmd_cn9k, 0, sizeof(cmd_cn9k)); + cmd = &cmd_cn9k[0]; + } else { +
[PATCH 4/6] net/cnxk: increment number of flow pattern
From: Amit Prakash Shukla Increment nb_pattern count to include RTE_FLOW_ITEM_TYPE_END. Signed-off-by: Amit Prakash Shukla --- drivers/net/cnxk/cnxk_rep_flow.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/cnxk/cnxk_rep_flow.c b/drivers/net/cnxk/cnxk_rep_flow.c index d26f5aa12c..f1cf81a90c 100644 --- a/drivers/net/cnxk/cnxk_rep_flow.c +++ b/drivers/net/cnxk/cnxk_rep_flow.c @@ -171,6 +171,9 @@ populate_vxlan_encap_action_conf(const struct rte_flow_action_vxlan_encap *vxlan for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) nb_patterns++; + /* +1 for RTE_FLOW_ITEM_TYPE_END */ + nb_patterns++; + len = sizeof(uint64_t); rte_memcpy(vxlan_encap_action_data, &nb_patterns, len); pattern = vxlan_conf->definition; -- 2.18.0
[PATCH 5/6] net/cnxk: update processing ready message
From: Hanumanth Pothula Now, dpu offload application sends READY measage with only MAC port's hw_funcs. Hence, process the READY message accordingly. Signed-off-by: Hanumanth Pothula --- drivers/net/cnxk/cnxk_rep_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c index f3a62a805e..53c94fbb0d 100644 --- a/drivers/net/cnxk/cnxk_rep_msg.c +++ b/drivers/net/cnxk/cnxk_rep_msg.c @@ -374,7 +374,7 @@ notify_rep_dev_ready(cnxk_rep_msg_ready_data_t *rdata, void *data, goto fail; } - for (i = 0; i < rdata->nb_ports / 2; i++) { + for (i = 0; i < rdata->nb_ports; i++) { rep_id = UINT16_MAX; rc = cnxk_rep_state_update(eswitch_dev, rdata->data[i], &rep_id); if (rc) { -- 2.18.0
[PATCH 6/6] common/cnxk: flow aginig delaying app shutdown
If flow aging is enabled application termination may take time equivalent to aging timeout. This is because on termination flow thread uses a sleep call which is uninterruptible. Signed-off-by: Harman Kalra Signed-off-by: Kiran Kumar K --- drivers/common/cnxk/roc_npc_aging.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c index 15f6e61d76..66c953135a 100644 --- a/drivers/common/cnxk/roc_npc_aging.c +++ b/drivers/common/cnxk/roc_npc_aging.c @@ -133,6 +133,21 @@ npc_mcam_get_hit_status(struct npc *npc, uint64_t *mcam_ids, uint16_t start_id, return rc; } +static void +npc_age_wait_until(struct roc_npc_flow_age *flow_age) +{ +#define NPC_AGE_WAIT_TIMEOUT_MS 1000 +#define NPC_AGE_WAIT_TIMEOUT_US (NPC_AGE_WAIT_TIMEOUT_MS * NPC_AGE_WAIT_TIMEOUT_MS) + uint64_t timeout = 0; + uint64_t sleep = 10 * NPC_AGE_WAIT_TIMEOUT_MS; + + do { + plt_delay_us(sleep); + timeout += sleep; + } while (!flow_age->aged_flows_get_thread_exit && +(timeout < (flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US))); +} + uint32_t npc_aged_flows_get(void *args) { @@ -197,7 +212,7 @@ npc_aged_flows_get(void *args) plt_seqcount_write_end(&flow_age->seq_cnt); lbl_sleep: - sleep(flow_age->aging_poll_freq); + npc_age_wait_until(flow_age); } return 0; -- 2.18.0
Re: [PATCH] meson: use built-in 'modules' helper for python dependencies
On Sun, Jun 23, 2024 at 01:30:23PM +0100, luca.bocca...@gmail.com wrote: > From: Luca Boccassi > > We now require Meson 0.53 or later, so we can use this feature introduced > in 0.51. This also fixes a build failure on SUSE Leap 15.6. > > Cc: sta...@dpdk.org > > Signed-off-by: Luca Boccassi Acked-by: Bruce Richardson
RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM IPsec operation
> > > > > > > > Subject: RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize > > > > > > > > AES-GCM IPsec operation > > > > > > > > > > > > > > > > > To optimize AES-GCM IPsec operation within crypto/mlx5, > > > > > > > > > the DPDK API typically supplies AES_GCM AAD/Payload/Digest > > > > > > > > > in separate locations, potentially disrupting their > > > > > > > > > contiguous layout. In cases where the memory layout fails > > > > > > > > > to meet hardware (HW) requirements, an UMR WQE is > > > > > > > > > initiated ahead of the GCM's GGA WQE to establish a > > > > > > > > > continuous AAD/Payload/Digest virtual memory space for > > > > > the > > > > > > HW MMU. > > > > > > > > > > > > > > > > > > For IPsec scenarios, where the memory layout consistently > > > > > > > > > adheres to the fixed order of AAD/IV/Payload/Digest, > > > > > > > > > directly shrinking memory for AAD proves more efficient > > > > > > > > > than preparing a UMR WQE. To address this, a new devarg > > > > > > > > > "crypto_mode" with mode "ipsec_opt" is introduced in the > > > > > > > > > commit, offering an optimization hint specifically for > > > > > > > > > IPsec cases. When enabled, the PMD copies AAD directly > > > > > > > > > before Payload in the enqueue_burst function instead of > > employing the UMR WQE. > > > > > > > > > Subsequently, in the dequeue_burst function, the > > > > > > > > > overridden IV before Payload is restored from the GGA WQE. > > > > > > > > > It's crucial for users to avoid utilizing the input mbuf > > > > > > > > > data > > > > > during > > > > > > processing. > > > > > > > > > > > > > > > > This seems very specific to mlx5 and is not as per the > > > > > > > > expectations of cryptodev APIs. > > > > > > > > > > > > > > > > It seems you are asking to alter the user application to > > > > > > > > accommodate this to support IPsec. > > > > > > > > > > > > > > > > Cryptodev APIs are for generic crypto processing of data as > > > > > > > > defined in rte_crypto_op. > > > > > > > > With your proposed changes, it seems the behavior of the > > > > > > > > crypto APIs will be different in case of mlx5 which I believe > > > > > > > > is not > > correct. > > > > > > > > > > > > > > > > Is it not possible for you to use rte_security IPsec path? > > > > > > > > > > > > > > > > > > > > > > Sorry I don't understand why that conflicts the API, IIUC > > > > > > > crypto API only just defines the AAD/Payload/Digest in struct > > > > > > > rte_crypto_sym_op, but not restrict the sequence, and > > > > > > > AAD/Payload/Digest may come from > > > > > > difference memory space. > > > > > > > Am I missing something here? > > > > > > > > > > > > Yes you are correct that there is no restriction there. > > > > > > > > > > > > > The input requirements from mlx5 HW is AAD/Payload/Digest > > > > > > > sequence, if the input memory of AAD/Payload/Digest does not > > > > > > > meet the requirements, PMD will try to combine the memory > > > > > > > address space with UMR WQE as that commit does by software > > shrink. > > > > > > > > > > > > And here, you are adding a restriction for IPsec case. > > > > > > I believe you need a way to identify IPsec case with non-ipsec > > > > > > case in data > > > > path. > > > > > > For that, instead of using a devarg(which is a specific case for > > > > > > mlx5), you can use generic rte_security session with action type > > > > > > RTE_SECURITY_ACTION_TYPE_NONE. > > > > > > > > > > Just to emphasize, this is not a restriction, we don't restrict > > > > > user must use that devarg for IPSEC case. > > > > > The way to identify or apply that optimization is user's devarg of > > > > "ipsec_opt". > > > > > Without that hint from devarg, pmd will work in UMR mode to > > > > > combine the memory addresses. > > > > > > > > Even if it is an optional thing. > > > > After adding the devarg, the user is expected to use the buffers the > > > > way your PMD is expecting. So, this is a restriction. Right? > > > > > > The devarg is not enabled by default, if user adds the devarg, that > > > means user know what he is doing, and the input is suitable for that > > optimization. > > > PMD doesn't restrict user must use that hint to handle IPsec case, > > > user will still be able to handle IPsec operation without that devarg. > > > > Devarg is optional and not enabled by default. That is clear to me at the > > first > > place. > > > > The point is PMD devarg can dictate the behavior of PMD and NOT the user. > > The standard APIs are the ones which user must adhere to. > > > > You cannot expect a user to change its code when it wants to use the devarg > > optimization. > > Sorry, it is my bad missing the background introduction here. In fact, the > motivation to implement that feature is not to request user to build the > memory > in that order. > Opsitely, after the first UMR version, we noticed that user may have IPsec as > input and that input can be optimized by that hint. > Since the API does not reject
Re: [PATCH v3 2/2] eventdev: add support for enqueue reorder
On Sat, Jun 22, 2024 at 4:02 AM Abdullah Sevincer wrote: > > This commit adds support flag to enable enqueue reorder > feature. > > When this flag is enabled in the port configuration PMD > restores dequeue order on enqueue if applications happen to > change it. > > Signed-off-by: Abdullah Sevincer > --- > lib/eventdev/rte_eventdev.h | 8 > 1 file changed, 8 insertions(+) > > diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h > index 08e5f9320b..f4220dd5dc 100644 > --- a/lib/eventdev/rte_eventdev.h > +++ b/lib/eventdev/rte_eventdev.h > @@ -1073,6 +1073,14 @@ rte_event_queue_attr_set(uint8_t dev_id, uint8_t > queue_id, uint32_t attr_id, > * @see rte_event_port_setup() > */ > > +#define RTE_EVENT_PORT_CFG_RESTORE_DEQ_ORDER (1ULL << 5) > +/**< Flag to enable feature enqueue reordering to dequeue. > + * The feature restores dequeue order on enqueue if applications > + * happen to change the order. # Is this feature or limitation? # What is the use case for this feature? # If application don't care about ORDER, they can use RTE_SCHED_TYPE_PARALLEL. Right? # Can you share the feature in the context of the below text in specification? /* Scheduler type definitions */ #define RTE_SCHED_TYPE_ORDERED 0 /**< Ordered scheduling * * Events from an ordered flow of an event queue can be scheduled to multiple * ports for concurrent processing while maintaining the original event order, * i.e. the order in which they were first enqueued to that queue. * This scheme allows events pertaining to the same, potentially large, flow to * be processed in parallel on multiple cores without incurring any * application-level order restoration logic overhead. * * After events are dequeued from a set of ports, as those events are re-enqueued * to another queue (with the op field set to @ref RTE_EVENT_OP_FORWARD), the event * device restores the original event order - including events returned from all * ports in the set - before the events are placed on the destination queue, * for subsequent scheduling to ports - > + * > + * @see rte_event_port_setup() > + */ > + > /** Event port configuration structure */ > struct rte_event_port_conf { > int32_t new_event_threshold; > -- > 2.25.1 >
RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM IPsec operation
> -Original Message- > From: Akhil Goyal > Sent: Monday, June 24, 2024 4:28 PM > To: Suanming Mou ; Matan Azrad > > Cc: dev@dpdk.org > Subject: RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM > IPsec operation > > > Just to be more accurate, in fact our current PMD has supported IPsec > > already via UMR's way. This series is an optimization, not newly > > supporting IPsec, but to optimize the IPsec input case. > > And like I replied above, it is not the patches invites the layout and > > require user to have such buffers, but the truth is we want to better > > serve the IPsec input come with that layout case in the real world as API > does not reject that IPsec input. > > Ok got it. > > But if we set the devarg for a mlx5 device, it will be a hint to the PMD for > all > the flows that it will process. Right? Yes, right. If the devarg is set, means user knows he only has that IPsec inputs for all the flows. If not, user will not set that devarg. > > And there may be an application use case where it has 2 separate flows > simultaneously - IPsec and non-IPsec. > > Then how would PMD handle that? > Will it assume contiguous memory for non-IPsec case as well? > How will PMD identify between IPsec and non-IPsec case? In that case, user will not set the devarg, PMD will always use UMR WQE to build contiguous memory address space for HW. No matter it is IPsec or non-IPsec. Background: UMR WQE is a powerful WQE can generate new contiguous new address space with several inputs. e.g.: If we have 3 non-contiguous inputs addr_a, addr_b, addr_c, UMR WQE can generate a new addr_d with these 3 memory address space combined. The only disadvantage is that UMR WQE is a bit heavy for using in the simple IPsec case. So we add that small optimization if user only use IPsec as inputs. > > Thanks, Suanming
RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM IPsec operation
> > Subject: RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM > > IPsec operation > > > > > Just to be more accurate, in fact our current PMD has supported IPsec > > > already via UMR's way. This series is an optimization, not newly > > > supporting IPsec, but to optimize the IPsec input case. > > > And like I replied above, it is not the patches invites the layout and > > > require user to have such buffers, but the truth is we want to better > > > serve the IPsec input come with that layout case in the real world as API > > does not reject that IPsec input. > > > > Ok got it. > > > > But if we set the devarg for a mlx5 device, it will be a hint to the PMD > > for all > > the flows that it will process. Right? > > Yes, right. If the devarg is set, means user knows he only has that IPsec > inputs for > all the flows. > If not, user will not set that devarg. > > > > > And there may be an application use case where it has 2 separate flows > > simultaneously - IPsec and non-IPsec. > > > > Then how would PMD handle that? > > Will it assume contiguous memory for non-IPsec case as well? > > How will PMD identify between IPsec and non-IPsec case? > > In that case, user will not set the devarg, PMD will always use UMR WQE to > build > contiguous memory address space for HW. No matter it is IPsec or non-IPsec. > > Background: UMR WQE is a powerful WQE can generate new contiguous new > address space with several inputs. e.g.: > If we have 3 non-contiguous inputs addr_a, addr_b, addr_c, UMR WQE can > generate a new addr_d with these 3 memory address space combined. > The only disadvantage is that UMR WQE is a bit heavy for using in the simple > IPsec case. So we add that small optimization if user only use IPsec as > inputs. > I do not see this limitation added in the documentation of the devarg/ PMD. Please update documentation to remove this confusion.
RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM IPsec operation
> -Original Message- > From: Akhil Goyal > Sent: Monday, June 24, 2024 4:45 PM > To: Suanming Mou ; Matan Azrad > > Cc: dev@dpdk.org > Subject: RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM > IPsec operation > > > > Subject: RE: [EXTERNAL] [PATCH v2 1/2] crypto/mlx5: optimize AES-GCM > > > IPsec operation > > > > > > > Just to be more accurate, in fact our current PMD has supported > > > > IPsec already via UMR's way. This series is an optimization, not > > > > newly supporting IPsec, but to optimize the IPsec input case. > > > > And like I replied above, it is not the patches invites the layout > > > > and require user to have such buffers, but the truth is we want to > > > > better serve the IPsec input come with that layout case in the > > > > real world as API > > > does not reject that IPsec input. > > > > > > Ok got it. > > > > > > But if we set the devarg for a mlx5 device, it will be a hint to the > > > PMD for all the flows that it will process. Right? > > > > Yes, right. If the devarg is set, means user knows he only has that > > IPsec inputs for all the flows. > > If not, user will not set that devarg. > > > > > > > > And there may be an application use case where it has 2 separate > > > flows simultaneously - IPsec and non-IPsec. > > > > > > Then how would PMD handle that? > > > Will it assume contiguous memory for non-IPsec case as well? > > > How will PMD identify between IPsec and non-IPsec case? > > > > In that case, user will not set the devarg, PMD will always use UMR > > WQE to build contiguous memory address space for HW. No matter it is > IPsec or non-IPsec. > > > > Background: UMR WQE is a powerful WQE can generate new contiguous > new > > address space with several inputs. e.g.: > > If we have 3 non-contiguous inputs addr_a, addr_b, addr_c, UMR WQE can > > generate a new addr_d with these 3 memory address space combined. > > The only disadvantage is that UMR WQE is a bit heavy for using in the > > simple IPsec case. So we add that small optimization if user only use IPsec > as inputs. > > > I do not see this limitation added in the documentation of the devarg/ PMD. > > Please update documentation to remove this confusion. Sure, will update.
Re: [PATCH 1/6] net/cnxk: stale offload flag reset
On Mon, Jun 24, 2024 at 1:19 PM Harman Kalra wrote: > > From: Amit Prakash Shukla > > mbuf buffer is not reset on tx and hence few fields has stale data from > previous packets. Due to stale offload flags, in one of the scenarios > with OVS, VxLAN offload flag was set while packet did not have the VxLAN > header. In the OVS packet path, the flag was read and accordingly VxLAN > processing was done but as packet did not have VxLAN header it caused > segfault. > > This patch resets mbuf offload flags in rx burst function. Update the git commit in fix in nature and add Fixes: tag > > Signed-off-by: Amit Prakash Shukla > --- > drivers/net/cnxk/cnxk_eswitch_rxtx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c > b/drivers/net/cnxk/cnxk_eswitch_rxtx.c > index d57e32b091..0200392f2d 100644 > --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c > +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c > @@ -194,7 +194,7 @@ cnxk_eswitch_dev_rx_burst(struct cnxk_eswitch_dev > *eswitch_dev, uint16_t qid, > mbuf->vlan_tci = rx->vtag0_tci; > /* Populate RSS hash */ > mbuf->hash.rss = cqe->tag; > - mbuf->ol_flags |= RTE_MBUF_F_RX_RSS_HASH; > + mbuf->ol_flags = RTE_MBUF_F_RX_RSS_HASH; > pkts[pkt] = mbuf; > roc_prefetch_store_keep(mbuf); > plt_esw_dbg("Packet %d rec on queue %d esw qid %d hash %x > mbuf %p vlan tci %d", > -- > 2.18.0 >
Re: [PATCH 4/6] net/cnxk: increment number of flow pattern
On Mon, Jun 24, 2024 at 1:20 PM Harman Kalra wrote: > > From: Amit Prakash Shukla > > Increment nb_pattern count to include RTE_FLOW_ITEM_TYPE_END. Is n't fix? If so, Fixes tag > Signed-off-by: Amit Prakash Shukla > --- > drivers/net/cnxk/cnxk_rep_flow.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/cnxk/cnxk_rep_flow.c > b/drivers/net/cnxk/cnxk_rep_flow.c > index d26f5aa12c..f1cf81a90c 100644 > --- a/drivers/net/cnxk/cnxk_rep_flow.c > +++ b/drivers/net/cnxk/cnxk_rep_flow.c > @@ -171,6 +171,9 @@ populate_vxlan_encap_action_conf(const struct > rte_flow_action_vxlan_encap *vxlan > for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) > nb_patterns++; > > + /* +1 for RTE_FLOW_ITEM_TYPE_END */ > + nb_patterns++; > + > len = sizeof(uint64_t); > rte_memcpy(vxlan_encap_action_data, &nb_patterns, len); > pattern = vxlan_conf->definition; > -- > 2.18.0 >
Re: [PATCH] meson: use built-in 'modules' helper for python dependencies
On Sun, Jun 23, 2024 at 2:30 PM wrote: > > From: Luca Boccassi > > We now require Meson 0.53 or later, so we can use this feature introduced > in 0.51. This also fixes a build failure on SUSE Leap 15.6. @Luca The patch lgtm, but could you develop on what was wrong with SUSE? > Cc: sta...@dpdk.org @Kevin. Just a note, this patch is probably not relevant to 21.11 as the switch to meson 0.53.2 was done in 22.11. > > Signed-off-by: Luca Boccassi -- David Marchand
[PATCH v3 0/2] crypto/mlx5: optimize AES-GCM IPsec operation
To optimize AES-GCM IPsec operation within crypto/mlx5, the DPDK API typically supplies AES_GCM AAD/Payload/Digest in separate locations, potentially disrupting their contiguous layout. In cases where the memory layout fails to meet hardware (HW) requirements, an UMR WQE is initiated ahead of the GCM's GGA WQE to establish a continuous AAD/Payload/Digest virtual memory space for the HW MMU. For IPsec scenarios, where the memory layout consistently adheres to the fixed order of AAD/IV/Payload/Digest, directly shrinking memory for AAD proves more efficient than preparing a UMR WQE. To address this, a new devarg "crypto_mode" with mode "ipsec_opt" is introduced in the commit, offering an optimization hint specifically for IPsec cases. When enabled, the PMD copies AAD directly before Payload in the enqueue_burst function instead of employing the UMR WQE. Subsequently, in the dequeue_burst function, the overridden IV before Payload is restored from the GGA WQE. It's crucial for users to avoid utilizing the input mbuf data during processing. v3: add limitation for non-contiguous inputs. v2: rebase version Suanming Mou (2): crypto/mlx5: optimize AES-GCM IPsec operation crypto/mlx5: add out of place mode for IPsec operation doc/guides/cryptodevs/mlx5.rst | 24 +++ doc/guides/rel_notes/release_24_07.rst | 4 + drivers/crypto/mlx5/mlx5_crypto.c | 22 ++- drivers/crypto/mlx5/mlx5_crypto.h | 19 ++ drivers/crypto/mlx5/mlx5_crypto_gcm.c | 245 +++-- 5 files changed, 293 insertions(+), 21 deletions(-) -- 2.34.1
[PATCH v3 1/2] crypto/mlx5: optimize AES-GCM IPsec operation
To optimize AES-GCM IPsec operation within crypto/mlx5, the DPDK API typically supplies AES_GCM AAD/Payload/Digest in separate locations, potentially disrupting their contiguous layout. In cases where the memory layout fails to meet hardware (HW) requirements, an UMR WQE is initiated ahead of the GCM's GGA WQE to establish a continuous AAD/Payload/Digest virtual memory space for the HW MMU. For IPsec scenarios, where the memory layout consistently adheres to the fixed order of AAD/IV/Payload/Digest, directly shrinking memory for AAD proves more efficient than preparing a UMR WQE. To address this, a new devarg "crypto_mode" with mode "ipsec_opt" is introduced in the commit, offering an optimization hint specifically for IPsec cases. When enabled, the PMD copies AAD directly before Payload in the enqueue_burst function instead of employing the UMR WQE. Subsequently, in the dequeue_burst function, the overridden IV before Payload is restored from the GGA WQE. It's crucial for users to avoid utilizing the input mbuf data during processing. Signed-off-by: Suanming Mou Acked-by: Matan Azrad --- v3: add limitation for non-contiguous inputs. v2: rebase version. --- doc/guides/cryptodevs/mlx5.rst | 21 +++ doc/guides/rel_notes/release_24_07.rst | 4 + drivers/crypto/mlx5/mlx5_crypto.c | 24 ++- drivers/crypto/mlx5/mlx5_crypto.h | 19 +++ drivers/crypto/mlx5/mlx5_crypto_gcm.c | 220 +++-- 5 files changed, 266 insertions(+), 22 deletions(-) diff --git a/doc/guides/cryptodevs/mlx5.rst b/doc/guides/cryptodevs/mlx5.rst index 8c05759ae7..fd0aa1ed8b 100644 --- a/doc/guides/cryptodevs/mlx5.rst +++ b/doc/guides/cryptodevs/mlx5.rst @@ -185,6 +185,25 @@ for an additional list of options shared with other mlx5 drivers. Maximum number of mbuf chain segments(src or dest), default value is 8. +- ``crypto_mode`` parameter [string] + + Only valid in AES-GCM mode. Will be ignored in AES-XTS mode. + + - ``full_capable`` + Use UMR WQE for inputs not as contiguous AAD/Payload/Digest. + + - ``ipsec_opt`` + Do software AAD shrink for inputs as contiguous AAD/IV/Payload/Digest. + The PMD relies on the IPsec layout, expecting the memory to align with + AAD/IV/Payload/Digest in a contiguous manner, all within a single mbuf + for any given OP. + The PMD extracts the ESP.IV bytes from the input memory and binds the + AAD (ESP SPI and SN) to the payload during enqueue OP. It then restores + the original memory layout in the decrypt OP. + ESP.IV size supported range is [0,16] bytes. + + Set to ``full_capable`` by default. + Supported NICs -- @@ -205,6 +224,8 @@ Limitations values. - AES-GCM is supported only on BlueField-3. - AES-GCM supports only key import plaintext mode. +- AES-GCM ``ipsec_opt`` mode does not support non-contiguous AAD/Payload/Digest + and multi-segment mode. Prerequisites diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index 7c88de381b..4e71573316 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -144,6 +144,10 @@ New Features Added an API that allows the user to reclaim the defer queue with RCU. +* **Updated NVIDIA mlx5 crypto driver.** + + * Added AES-GCM IPsec operation optimization. + Removed Items - diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index 26bd4087da..d49a375dcb 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -25,10 +25,6 @@ #define MLX5_CRYPTO_FEATURE_FLAGS(wrapped_mode) \ (RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_HW_ACCELERATED | \ -RTE_CRYPTODEV_FF_IN_PLACE_SGL | RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | \ -RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | \ -RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT | \ -RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | \ (wrapped_mode ? RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY : 0) | \ RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS) @@ -60,6 +56,14 @@ mlx5_crypto_dev_infos_get(struct rte_cryptodev *dev, dev_info->driver_id = mlx5_crypto_driver_id; dev_info->feature_flags = MLX5_CRYPTO_FEATURE_FLAGS(priv->is_wrapped_mode); + if (!mlx5_crypto_is_ipsec_opt(priv)) + dev_info->feature_flags |= + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT; + dev_info->capabilities = priv->caps; dev_info->max_nb_queue_pairs = MLX5_CRYPTO_MAX_QPS; if (priv->caps->sym.xform_type == RTE_CRYPTO_SYM_XFORM_
[PATCH v3 2/2] crypto/mlx5: add out of place mode for IPsec operation
The IPsec operation shrinks AAD directly before payload in enqueue burst and restores the memory in dequeue burst. This commit adds the support of OOP mode follows the similar strategy. Signed-off-by: Suanming Mou Acked-by: Matan Azrad --- doc/guides/cryptodevs/mlx5.rst| 3 ++ drivers/crypto/mlx5/mlx5_crypto.c | 2 +- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 43 +-- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/doc/guides/cryptodevs/mlx5.rst b/doc/guides/cryptodevs/mlx5.rst index fd0aa1ed8b..0568852571 100644 --- a/doc/guides/cryptodevs/mlx5.rst +++ b/doc/guides/cryptodevs/mlx5.rst @@ -201,6 +201,9 @@ for an additional list of options shared with other mlx5 drivers. AAD (ESP SPI and SN) to the payload during enqueue OP. It then restores the original memory layout in the decrypt OP. ESP.IV size supported range is [0,16] bytes. + For OOP case, PMD will replace the bytes preceding the OP destination + address to match the information found between the AAD pointer and the + OP source address. User should prepare this headroom in this case. Set to ``full_capable`` by default. diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index d49a375dcb..bf9cbd4a6a 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -25,6 +25,7 @@ #define MLX5_CRYPTO_FEATURE_FLAGS(wrapped_mode) \ (RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_HW_ACCELERATED | \ +RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | \ (wrapped_mode ? RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY : 0) | \ RTE_CRYPTODEV_FF_CIPHER_MULTIPLE_DATA_UNITS) @@ -61,7 +62,6 @@ mlx5_crypto_dev_infos_get(struct rte_cryptodev *dev, RTE_CRYPTODEV_FF_IN_PLACE_SGL | RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | - RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT; dev_info->capabilities = priv->caps; diff --git a/drivers/crypto/mlx5/mlx5_crypto_gcm.c b/drivers/crypto/mlx5/mlx5_crypto_gcm.c index 189e798d1d..f598273873 100644 --- a/drivers/crypto/mlx5/mlx5_crypto_gcm.c +++ b/drivers/crypto/mlx5/mlx5_crypto_gcm.c @@ -1000,6 +1000,7 @@ mlx5_crypto_gcm_ipsec_enqueue_burst(void *queue_pair, struct mlx5_crypto_gcm_data gcm_data; struct rte_crypto_op *op; struct rte_mbuf *m_src; + struct rte_mbuf *m_dst; uint16_t mask = qp->entries_n - 1; uint16_t remain = qp->entries_n - (qp->pi - qp->qp_ci); uint32_t idx; @@ -1029,19 +1030,32 @@ mlx5_crypto_gcm_ipsec_enqueue_burst(void *queue_pair, MLX5_ASSERT(pkt_iv_len <= MLX5_CRYPTO_GCM_IPSEC_IV_SIZE); gcm_data.src_bytes = op->sym->aead.data.length + sess->aad_len; gcm_data.src_mkey = mlx5_mr_mb2mr(&qp->mr_ctrl, op->sym->m_src); - /* OOP mode is not supported. */ - MLX5_ASSERT(!op->sym->m_dst || op->sym->m_dst == m_src); - gcm_data.dst_addr = gcm_data.src_addr; - gcm_data.dst_mkey = gcm_data.src_mkey; + m_dst = op->sym->m_dst; + if (m_dst && m_dst != m_src) { + MLX5_ASSERT(m_dst->nb_segs == 1 && + (rte_pktmbuf_headroom(m_dst) + op->sym->aead.data.offset) + >= sess->aad_len + pkt_iv_len); + gcm_data.dst_addr = RTE_PTR_SUB + (rte_pktmbuf_mtod_offset(m_dst, +void *, op->sym->aead.data.offset), sess->aad_len); + gcm_data.dst_mkey = mlx5_mr_mb2mr(&qp->mr_ctrl, m_dst); + } else { + gcm_data.dst_addr = gcm_data.src_addr; + gcm_data.dst_mkey = gcm_data.src_mkey; + } gcm_data.dst_bytes = gcm_data.src_bytes; /* Digest should follow payload. */ - MLX5_ASSERT(RTE_PTR_ADD - (gcm_data.src_addr, sess->aad_len + op->sym->aead.data.length) == - op->sym->aead.digest.data); - if (sess->op_type == MLX5_CRYPTO_OP_TYPE_ENCRYPTION) + if (sess->op_type == MLX5_CRYPTO_OP_TYPE_ENCRYPTION) { + MLX5_ASSERT(RTE_PTR_ADD(gcm_data.dst_addr, + sess->aad_len + op->sym->aead.data.length) == + op->sym->aead.digest.data); gcm_data.dst_bytes += sess->tag_len; - else + } else { + MLX5_ASSERT(RTE_PTR_ADD(gcm_data.src_addr, + sess->aad_len + op->sym->aead.data.length) == +
Re: [PATCH] vhost: Fix the crash caused by accessing the released memory
Hi, On 6/19/24 14:27, zhaoxinxin wrote: The rte_vhost_driver_unregister() vhost_user_read_cb() vhost_user_client_reconnect() can be called at the same time by 3 threads. when memory of vsocket is freed in rte_vhost_driver_unregister(), then vhost_user_read_cb() maybe add vsocket to reconn_list, the invalid memory of vsocket is accessed in vhost_user_client_reconnect(). It is not clear to me why 3 threads are calling rte_vhost_driver_unregister() at the same time, isn't it an application issue? The core trace is: Program terminated with signal 11, Segmentation fault. The fix is to perform a delete operation again after releasing the memory We need a Fixes tag and Cc sta...@dpdk.org so that it is backported. Signed-off-by: zhaoxinxin <15957197...@163.com> The format is Firstname Lastname --- lib/vhost/socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index a75728a2e4..01946096c4 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -1121,6 +1121,8 @@ rte_vhost_driver_unregister(const char *path) if (vsocket->is_server) { close(vsocket->socket_fd); unlink(path); + } else if (vsocket->reconnect) { + vhost_user_remove_reconnect(vsocket); } pthread_mutex_destroy(&vsocket->conn_mutex);
Re: [PATCH] meson: use built-in 'modules' helper for python dependencies
On 24/06/2024 10:15, David Marchand wrote: > On Sun, Jun 23, 2024 at 2:30 PM wrote: >> >> From: Luca Boccassi >> >> We now require Meson 0.53 or later, so we can use this feature introduced >> in 0.51. This also fixes a build failure on SUSE Leap 15.6. > > @Luca > The patch lgtm, but could you develop on what was wrong with SUSE? > > >> Cc: sta...@dpdk.org > > @Kevin. > Just a note, this patch is probably not relevant to 21.11 as the > switch to meson 0.53.2 was done in 22.11. > Ack. thanks for letting me know. >> >> Signed-off-by: Luca Boccassi > >
[PATCH] eventdev/dma: fix missing response info in forward mode
From: Pavan Nikhilesh When in OP_FWD mode the DMA completion response should use the `rte_event_dma_adapter_op::event_meta` to inject the completion event. Bugzilla ID: 1469 Fixes: 588dcac23610 ("eventdev/dma: reorganize event DMA ops") Signed-off-by: Pavan Nikhilesh --- app/test/test_event_dma_adapter.c| 10 +++--- lib/eventdev/rte_event_dma_adapter.c | 1 + lib/eventdev/rte_event_dma_adapter.h | 11 ++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/test/test_event_dma_adapter.c b/app/test/test_event_dma_adapter.c index d9dff4ff7d..3b39521153 100644 --- a/app/test/test_event_dma_adapter.c +++ b/app/test/test_event_dma_adapter.c @@ -61,7 +61,8 @@ struct rte_event dma_response_info = { .queue_id = TEST_APP_EV_QUEUE_ID, .sched_type = RTE_SCHED_TYPE_ATOMIC, .flow_id = TEST_APP_EV_FLOWID, - .priority = TEST_APP_EV_PRIORITY + .priority = TEST_APP_EV_PRIORITY, + .op = RTE_EVENT_OP_NEW, }; static struct event_dma_adapter_test_params params; @@ -263,10 +264,12 @@ test_op_forward_mode(void) op->op_mp = params.op_mpool; op->dma_dev_id = TEST_DMA_DEV_ID; op->vchan = TEST_DMA_VCHAN_ID; + op->event_meta = dma_response_info.event; /* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ memset(&ev[i], 0, sizeof(struct rte_event)); ev[i].event = 0; + ev[i].op = RTE_EVENT_OP_NEW; ev[i].event_type = RTE_EVENT_TYPE_DMADEV; ev[i].queue_id = TEST_DMA_EV_QUEUE_ID; ev[i].sched_type = RTE_SCHED_TYPE_ATOMIC; @@ -574,10 +577,11 @@ configure_event_dma_adapter(enum rte_event_dma_adapter_mode mode) ret = rte_event_dma_adapter_create(TEST_ADAPTER_ID, evdev, &conf, mode); TEST_ASSERT_SUCCESS(ret, "Failed to create event dma adapter\n"); - if (cap & RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND) { + event.event = dma_response_info.event; + if (cap & RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND) ret = rte_event_dma_adapter_vchan_add(TEST_ADAPTER_ID, TEST_DMA_DEV_ID, TEST_DMA_VCHAN_ID, &event); - } else + else ret = rte_event_dma_adapter_vchan_add(TEST_ADAPTER_ID, TEST_DMA_DEV_ID, TEST_DMA_VCHAN_ID, NULL); diff --git a/lib/eventdev/rte_event_dma_adapter.c b/lib/eventdev/rte_event_dma_adapter.c index e52ef46a1b..ff2bc408c1 100644 --- a/lib/eventdev/rte_event_dma_adapter.c +++ b/lib/eventdev/rte_event_dma_adapter.c @@ -666,6 +666,7 @@ edma_ops_enqueue_burst(struct event_dma_adapter *adapter, struct rte_event_dma_a ev->op = RTE_EVENT_OP_FORWARD; else ev->op = RTE_EVENT_OP_NEW; + ev->event = ops[i]->event_meta; } do { diff --git a/lib/eventdev/rte_event_dma_adapter.h b/lib/eventdev/rte_event_dma_adapter.h index 048ddba3f3..768390cd30 100644 --- a/lib/eventdev/rte_event_dma_adapter.h +++ b/lib/eventdev/rte_event_dma_adapter.h @@ -179,8 +179,17 @@ struct rte_event_dma_adapter_op { * The dma device implementation should not modify this area. */ uint64_t event_meta; - /**< Event metadata that defines event attributes when used in OP_NEW mode. + /**< Event metadata of DMA completion event. +* Used when RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND is not +* supported in OP_NEW mode. * @see rte_event_dma_adapter_mode::RTE_EVENT_DMA_ADAPTER_OP_NEW +* @see RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND +* +* Used when RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD is not +* supported in OP_FWD mode. +* @see rte_event_dma_adapter_mode::RTE_EVENT_DMA_ADAPTER_OP_FORWARD +* @see RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD +* * @see struct rte_event::event */ int16_t dma_dev_id; -- 2.25.1
[PATCH v5 00/21] Update MEV TS Base Driver
--- v5: - Removed warning from patch 6 --- v4: - Removed 1st patch as we are not using NVME_CPF flag - Addressed comments --- v3: - Removed additional whitespace changes - Fixed warnings of CI - Updated documentation relating to MEV TS FW release --- v2: - Changed implementation based on review comments - Fixed compilation errors for Windows, Alpine and FreeBSD --- Soumyadeep Hore (21): common/idpf: updated IDPF VF device ID common/idpf: added new virtchnl2 capability and vport flag common/idpf: moved the idpf HW into API header file common/idpf: avoid defensive programming common/idpf: use BIT ULL for large bitmaps common/idpf: convert data type to 'le' common/idpf: compress RXDID mask definitions common/idpf: refactor size check macro common/idpf: update mask of Rx FLEX DESC ADV FF1 M common/idpf: use 'pad' and 'reserved' fields appropriately common/idpf: move related defines into enums common/idpf: avoid variable 0-init common/idpf: update in PTP message validation common/idpf: rename INLINE FLOW STEER to FLOW STEER common/idpf: add wmb before tail drivers: add flex array support and fix issues common/idpf: enable flow steer capability for vports common/idpf: add a new Tx context descriptor structure common/idpf: remove idpf common file drivers: adding type to idpf vc queue switch doc: updated the documentation for cpfl PMD doc/guides/nics/cpfl.rst |2 + drivers/common/idpf/base/idpf_common.c| 382 --- drivers/common/idpf/base/idpf_controlq.c | 66 +- drivers/common/idpf/base/idpf_controlq.h | 107 +- drivers/common/idpf/base/idpf_controlq_api.h | 35 + .../common/idpf/base/idpf_controlq_setup.c| 18 +- drivers/common/idpf/base/idpf_devids.h|5 +- drivers/common/idpf/base/idpf_lan_txrx.h | 20 +- drivers/common/idpf/base/idpf_osdep.h | 72 +- drivers/common/idpf/base/idpf_type.h |4 +- drivers/common/idpf/base/meson.build |1 - drivers/common/idpf/base/virtchnl2.h | 2388 + drivers/common/idpf/base/virtchnl2_lan_desc.h | 842 -- drivers/common/idpf/idpf_common_virtchnl.c| 10 +- drivers/common/idpf/idpf_common_virtchnl.h|2 +- drivers/net/cpfl/cpfl_ethdev.c| 40 +- drivers/net/cpfl/cpfl_rxtx.c | 12 +- drivers/net/idpf/idpf_rxtx.c | 12 +- 18 files changed, 2037 insertions(+), 1981 deletions(-) delete mode 100644 drivers/common/idpf/base/idpf_common.c -- 2.43.0
[PATCH v5 01/21] common/idpf: updated IDPF VF device ID
Update IDPF VF device id to 145C. Also added device ID for S-IOV device. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_devids.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/common/idpf/base/idpf_devids.h b/drivers/common/idpf/base/idpf_devids.h index c47762d5b7..1ae99fcee1 100644 --- a/drivers/common/idpf/base/idpf_devids.h +++ b/drivers/common/idpf/base/idpf_devids.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2001-2023 Intel Corporation + * Copyright(c) 2001-2024 Intel Corporation */ #ifndef _IDPF_DEVIDS_H_ @@ -10,7 +10,8 @@ /* Device IDs */ #define IDPF_DEV_ID_PF 0x1452 -#define IDPF_DEV_ID_VF 0x1889 +#define IDPF_DEV_ID_VF 0x145C +#define IDPF_DEV_ID_VF_SIOV0x0DD5 -- 2.43.0
[PATCH v5 02/21] common/idpf: added new virtchnl2 capability and vport flag
Removed unused VIRTCHNL2_CAP_ADQ capability and use that bit for VIRTCHNL2_CAP_INLINE_FLOW_STEER capability. Added VIRTCHNL2_VPORT_INLINE_FLOW_STEER_ENA port flag to allow enable/disable per vport. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 3900b784d0..6eff0f1ea1 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2001-2023 Intel Corporation + * Copyright(c) 2001-2024 Intel Corporation */ #ifndef _VIRTCHNL2_H_ @@ -220,7 +220,7 @@ #define VIRTCHNL2_CAP_FLOW_DIRECTORBIT(3) #define VIRTCHNL2_CAP_SPLITQ_QSCHEDBIT(4) #define VIRTCHNL2_CAP_CRC BIT(5) -#define VIRTCHNL2_CAP_ADQ BIT(6) +#define VIRTCHNL2_CAP_INLINE_FLOW_STEERBIT(6) #define VIRTCHNL2_CAP_WB_ON_ITRBIT(7) #define VIRTCHNL2_CAP_PROMISC BIT(8) #define VIRTCHNL2_CAP_LINK_SPEED BIT(9) @@ -593,7 +593,8 @@ struct virtchnl2_queue_reg_chunks { VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_queue_reg_chunks); /* VIRTCHNL2_VPORT_FLAGS */ -#define VIRTCHNL2_VPORT_UPLINK_PORTBIT(0) +#define VIRTCHNL2_VPORT_UPLINK_PORTBIT(0) +#define VIRTCHNL2_VPORT_INLINE_FLOW_STEER_ENA BIT(1) #define VIRTCHNL2_ETH_LENGTH_OF_ADDRESS 6 -- 2.43.0
[PATCH v5 03/21] common/idpf: moved the idpf HW into API header file
There is an issue of recursive header file includes in accessing the idpf_hw structure. The controlq.h has the structure definition and osdep header file needs that. The problem is the controlq.h also needs the osdep header file contents, basically both dependent on each other. Moving the definition from controlq.h into api.h resolves the problem. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_common.c | 4 +- drivers/common/idpf/base/idpf_controlq.h | 107 +-- drivers/common/idpf/base/idpf_controlq_api.h | 35 ++ drivers/common/idpf/base/idpf_osdep.h| 72 - drivers/common/idpf/base/idpf_type.h | 4 +- 5 files changed, 111 insertions(+), 111 deletions(-) diff --git a/drivers/common/idpf/base/idpf_common.c b/drivers/common/idpf/base/idpf_common.c index 7181a7f14c..bb540345c2 100644 --- a/drivers/common/idpf/base/idpf_common.c +++ b/drivers/common/idpf/base/idpf_common.c @@ -1,9 +1,9 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2001-2023 Intel Corporation + * Copyright(c) 2001-2024 Intel Corporation */ -#include "idpf_type.h" #include "idpf_prototype.h" +#include "idpf_type.h" #include diff --git a/drivers/common/idpf/base/idpf_controlq.h b/drivers/common/idpf/base/idpf_controlq.h index 80ca06e632..3f74b5a898 100644 --- a/drivers/common/idpf/base/idpf_controlq.h +++ b/drivers/common/idpf/base/idpf_controlq.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2001-2023 Intel Corporation + * Copyright(c) 2001-2024 Intel Corporation */ #ifndef _IDPF_CONTROLQ_H_ @@ -96,111 +96,6 @@ struct idpf_mbxq_desc { u32 pf_vf_id; /* used by CP when sending to PF */ }; -enum idpf_mac_type { - IDPF_MAC_UNKNOWN = 0, - IDPF_MAC_PF, - IDPF_MAC_VF, - IDPF_MAC_GENERIC -}; - -#define ETH_ALEN 6 - -struct idpf_mac_info { - enum idpf_mac_type type; - u8 addr[ETH_ALEN]; - u8 perm_addr[ETH_ALEN]; -}; - -#define IDPF_AQ_LINK_UP 0x1 - -/* PCI bus types */ -enum idpf_bus_type { - idpf_bus_type_unknown = 0, - idpf_bus_type_pci, - idpf_bus_type_pcix, - idpf_bus_type_pci_express, - idpf_bus_type_reserved -}; - -/* PCI bus speeds */ -enum idpf_bus_speed { - idpf_bus_speed_unknown = 0, - idpf_bus_speed_33 = 33, - idpf_bus_speed_66 = 66, - idpf_bus_speed_100 = 100, - idpf_bus_speed_120 = 120, - idpf_bus_speed_133 = 133, - idpf_bus_speed_2500 = 2500, - idpf_bus_speed_5000 = 5000, - idpf_bus_speed_8000 = 8000, - idpf_bus_speed_reserved -}; - -/* PCI bus widths */ -enum idpf_bus_width { - idpf_bus_width_unknown = 0, - idpf_bus_width_pcie_x1 = 1, - idpf_bus_width_pcie_x2 = 2, - idpf_bus_width_pcie_x4 = 4, - idpf_bus_width_pcie_x8 = 8, - idpf_bus_width_32 = 32, - idpf_bus_width_64 = 64, - idpf_bus_width_reserved -}; - -/* Bus parameters */ -struct idpf_bus_info { - enum idpf_bus_speed speed; - enum idpf_bus_width width; - enum idpf_bus_type type; - - u16 func; - u16 device; - u16 lan_id; - u16 bus_id; -}; - -/* Function specific capabilities */ -struct idpf_hw_func_caps { - u32 num_alloc_vfs; - u32 vf_base_id; -}; - -/* Define the APF hardware struct to replace other control structs as needed - * Align to ctlq_hw_info - */ -struct idpf_hw { - /* Some part of BAR0 address space is not mapped by the LAN driver. -* This results in 2 regions of BAR0 to be mapped by LAN driver which -* will have its own base hardware address when mapped. -*/ - u8 *hw_addr; - u8 *hw_addr_region2; - u64 hw_addr_len; - u64 hw_addr_region2_len; - - void *back; - - /* control queue - send and receive */ - struct idpf_ctlq_info *asq; - struct idpf_ctlq_info *arq; - - /* subsystem structs */ - struct idpf_mac_info mac; - struct idpf_bus_info bus; - struct idpf_hw_func_caps func_caps; - - /* pci info */ - u16 device_id; - u16 vendor_id; - u16 subsystem_device_id; - u16 subsystem_vendor_id; - u8 revision_id; - bool adapter_stopped; - - LIST_HEAD_TYPE(list_head, idpf_ctlq_info) cq_list_head; -}; - int idpf_ctlq_alloc_ring_res(struct idpf_hw *hw, struct idpf_ctlq_info *cq); diff --git a/drivers/common/idpf/base/idpf_controlq_api.h b/drivers/common/idpf/base/idpf_controlq_api.h index 38f5d2df3c..8a90258099 100644 --- a/drivers/common/idpf/base/idpf_controlq_api.h +++ b/drivers/common/idpf/base/idpf_controlq_api.h @@ -154,6 +154,41 @@ enum idpf_mbx_opc { idpf_mbq_opc_send_msg_to_peer_drv = 0x0804, }; +/* Define the APF hardware struct to replace other control structs as needed + * Align to ctlq_hw_info + */ +struct idpf_hw { + /* S
[PATCH v5 04/21] common/idpf: avoid defensive programming
Based on the upstream feedback, driver should not use any defensive programming strategy by checking for NULL pointers and other conditional checks unnecessarily in the code flow to fall back, instead fail and fix the bug in a proper way. As the control queue is freed and deleted from the list after the idpf_ctlq_shutdown call, there is no need to have the ring_size check in idpf_ctlq_shutdown. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_controlq.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c index a82ca628de..d9ca33cdb9 100644 --- a/drivers/common/idpf/base/idpf_controlq.c +++ b/drivers/common/idpf/base/idpf_controlq.c @@ -98,9 +98,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq) { idpf_acquire_lock(&cq->cq_lock); - if (!cq->ring_size) - goto shutdown_sq_out; - #ifdef SIMICS_BUILD wr32(hw, cq->reg.head, 0); wr32(hw, cq->reg.tail, 0); @@ -115,7 +112,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq) /* Set ring_size to 0 to indicate uninitialized queue */ cq->ring_size = 0; -shutdown_sq_out: idpf_release_lock(&cq->cq_lock); idpf_destroy_lock(&cq->cq_lock); } -- 2.43.0
[PATCH v5 05/21] common/idpf: use BIT ULL for large bitmaps
For bitmaps greater than 32 bits, use BIT_ULL instead of BIT macro as reported by compiler. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 70 ++-- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 6eff0f1ea1..851c6629dd 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -175,20 +175,20 @@ /* VIRTCHNL2_RSS_FLOW_TYPE_CAPS * Receive Side Scaling Flow type capability flags */ -#define VIRTCHNL2_CAP_RSS_IPV4_TCP BIT(0) -#define VIRTCHNL2_CAP_RSS_IPV4_UDP BIT(1) -#define VIRTCHNL2_CAP_RSS_IPV4_SCTPBIT(2) -#define VIRTCHNL2_CAP_RSS_IPV4_OTHER BIT(3) -#define VIRTCHNL2_CAP_RSS_IPV6_TCP BIT(4) -#define VIRTCHNL2_CAP_RSS_IPV6_UDP BIT(5) -#define VIRTCHNL2_CAP_RSS_IPV6_SCTPBIT(6) -#define VIRTCHNL2_CAP_RSS_IPV6_OTHER BIT(7) -#define VIRTCHNL2_CAP_RSS_IPV4_AH BIT(8) -#define VIRTCHNL2_CAP_RSS_IPV4_ESP BIT(9) -#define VIRTCHNL2_CAP_RSS_IPV4_AH_ESP BIT(10) -#define VIRTCHNL2_CAP_RSS_IPV6_AH BIT(11) -#define VIRTCHNL2_CAP_RSS_IPV6_ESP BIT(12) -#define VIRTCHNL2_CAP_RSS_IPV6_AH_ESP BIT(13) +#define VIRTCHNL2_CAP_RSS_IPV4_TCP BIT_ULL(0) +#define VIRTCHNL2_CAP_RSS_IPV4_UDP BIT_ULL(1) +#define VIRTCHNL2_CAP_RSS_IPV4_SCTPBIT_ULL(2) +#define VIRTCHNL2_CAP_RSS_IPV4_OTHER BIT_ULL(3) +#define VIRTCHNL2_CAP_RSS_IPV6_TCP BIT_ULL(4) +#define VIRTCHNL2_CAP_RSS_IPV6_UDP BIT_ULL(5) +#define VIRTCHNL2_CAP_RSS_IPV6_SCTPBIT_ULL(6) +#define VIRTCHNL2_CAP_RSS_IPV6_OTHER BIT_ULL(7) +#define VIRTCHNL2_CAP_RSS_IPV4_AH BIT_ULL(8) +#define VIRTCHNL2_CAP_RSS_IPV4_ESP BIT_ULL(9) +#define VIRTCHNL2_CAP_RSS_IPV4_AH_ESP BIT_ULL(10) +#define VIRTCHNL2_CAP_RSS_IPV6_AH BIT_ULL(11) +#define VIRTCHNL2_CAP_RSS_IPV6_ESP BIT_ULL(12) +#define VIRTCHNL2_CAP_RSS_IPV6_AH_ESP BIT_ULL(13) /* VIRTCHNL2_HEADER_SPLIT_CAPS * Header split capability flags @@ -214,32 +214,32 @@ * TX_VLAN: VLAN tag insertion * RX_VLAN: VLAN tag stripping */ -#define VIRTCHNL2_CAP_RDMA BIT(0) -#define VIRTCHNL2_CAP_SRIOVBIT(1) -#define VIRTCHNL2_CAP_MACFILTERBIT(2) -#define VIRTCHNL2_CAP_FLOW_DIRECTORBIT(3) -#define VIRTCHNL2_CAP_SPLITQ_QSCHEDBIT(4) -#define VIRTCHNL2_CAP_CRC BIT(5) -#define VIRTCHNL2_CAP_INLINE_FLOW_STEERBIT(6) -#define VIRTCHNL2_CAP_WB_ON_ITRBIT(7) -#define VIRTCHNL2_CAP_PROMISC BIT(8) -#define VIRTCHNL2_CAP_LINK_SPEED BIT(9) -#define VIRTCHNL2_CAP_INLINE_IPSEC BIT(10) -#define VIRTCHNL2_CAP_LARGE_NUM_QUEUES BIT(11) +#define VIRTCHNL2_CAP_RDMA BIT_ULL(0) +#define VIRTCHNL2_CAP_SRIOVBIT_ULL(1) +#define VIRTCHNL2_CAP_MACFILTERBIT_ULL(2) +#define VIRTCHNL2_CAP_FLOW_DIRECTORBIT_ULL(3) +#define VIRTCHNL2_CAP_SPLITQ_QSCHEDBIT_ULL(4) +#define VIRTCHNL2_CAP_CRC BIT_ULL(5) +#define VIRTCHNL2_CAP_INLINE_FLOW_STEERBIT_ULL(6) +#define VIRTCHNL2_CAP_WB_ON_ITRBIT_ULL(7) +#define VIRTCHNL2_CAP_PROMISC BIT_ULL(8) +#define VIRTCHNL2_CAP_LINK_SPEED BIT_ULL(9) +#define VIRTCHNL2_CAP_INLINE_IPSEC BIT_ULL(10) +#define VIRTCHNL2_CAP_LARGE_NUM_QUEUES BIT_ULL(11) /* require additional info */ -#define VIRTCHNL2_CAP_VLAN BIT(12) -#define VIRTCHNL2_CAP_PTP BIT(13) -#define VIRTCHNL2_CAP_ADV_RSS BIT(15) -#define VIRTCHNL2_CAP_FDIR BIT(16) -#define VIRTCHNL2_CAP_RX_FLEX_DESC BIT(17) -#define VIRTCHNL2_CAP_PTYPEBIT(18) -#define VIRTCHNL2_CAP_LOOPBACK BIT(19) +#define VIRTCHNL2_CAP_VLAN BIT_ULL(12) +#define VIRTCHNL2_CAP_PTP BIT_ULL(13) +#define VIRTCHNL2_CAP_ADV_RSS BIT_ULL(15) +#define VIRTCHNL2_CAP_FDIR BIT_ULL(16) +#define VIRTCHNL2_CAP_RX_FLEX_DESC BIT_ULL(17) +#define VIRTCHNL2_CAP_PTYPEBIT_ULL(18) +#define VIRTCHNL2_CAP_LOOPBACK BIT_ULL(19) /* Enable miss completion types plus ability to detect a miss completion if a * reserved bit is set in a standared completion's tag. */ -#define VIRTCHNL2_CAP_MISS_COMPL_TAG BIT(20) +#define VIRTCHNL2_CAP_MISS_COMPL_TAG BIT_ULL(20) /* this must be the last capability */ -#define VIRTCHNL2_CAP_OEM BIT(63) +#define VIRTCHNL2_CAP_OEM
[PATCH v5 06/21] common/idpf: convert data type to 'le'
'u32' data type is used for the struct members in 'virtchnl2_version_info' which should be '__le32'. Make the change accordingly. It is a Little Endian specific type definition. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 851c6629dd..1f59730297 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -471,8 +471,8 @@ * error regardless of version mismatch. */ struct virtchnl2_version_info { - u32 major; - u32 minor; + __le32 major; + __le32 minor; }; VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_version_info); -- 2.43.0
[PATCH v5 07/21] common/idpf: compress RXDID mask definitions
Instead of using the long RXDID definitions, introduce a macro which uses common part of the RXDID definitions i.e. VIRTCHNL2_RXDID_ and the bit passed to generate a mask. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2_lan_desc.h | 31 ++- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2_lan_desc.h b/drivers/common/idpf/base/virtchnl2_lan_desc.h index e6e782a219..f632271788 100644 --- a/drivers/common/idpf/base/virtchnl2_lan_desc.h +++ b/drivers/common/idpf/base/virtchnl2_lan_desc.h @@ -58,22 +58,23 @@ /* VIRTCHNL2_RX_DESC_ID_BITMASKS * Receive descriptor ID bitmasks */ -#define VIRTCHNL2_RXDID_0_16B_BASE_M BIT(VIRTCHNL2_RXDID_0_16B_BASE) -#define VIRTCHNL2_RXDID_1_32B_BASE_M BIT(VIRTCHNL2_RXDID_1_32B_BASE) -#define VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M BIT(VIRTCHNL2_RXDID_2_FLEX_SPLITQ) -#define VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M BIT(VIRTCHNL2_RXDID_2_FLEX_SQ_NIC) -#define VIRTCHNL2_RXDID_3_FLEX_SQ_SW_M BIT(VIRTCHNL2_RXDID_3_FLEX_SQ_SW) -#define VIRTCHNL2_RXDID_4_FLEX_SQ_NIC_VEB_M BIT(VIRTCHNL2_RXDID_4_FLEX_SQ_NIC_VEB) -#define VIRTCHNL2_RXDID_5_FLEX_SQ_NIC_ACL_M BIT(VIRTCHNL2_RXDID_5_FLEX_SQ_NIC_ACL) -#define VIRTCHNL2_RXDID_6_FLEX_SQ_NIC_2_M BIT(VIRTCHNL2_RXDID_6_FLEX_SQ_NIC_2) -#define VIRTCHNL2_RXDID_7_HW_RSVD_MBIT(VIRTCHNL2_RXDID_7_HW_RSVD) +#define VIRTCHNL2_RXDID_M(bit) BIT(VIRTCHNL2_RXDID_##bit) +#define VIRTCHNL2_RXDID_0_16B_BASE_M VIRTCHNL2_RXDID_M(0_16B_BASE) +#define VIRTCHNL2_RXDID_1_32B_BASE_M VIRTCHNL2_RXDID_M(1_32B_BASE) +#define VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M VIRTCHNL2_RXDID_M(2_FLEX_SPLITQ) +#define VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M VIRTCHNL2_RXDID_M(2_FLEX_SQ_NIC) +#define VIRTCHNL2_RXDID_3_FLEX_SQ_SW_M VIRTCHNL2_RXDID_M(3_FLEX_SQ_SW) +#define VIRTCHNL2_RXDID_4_FLEX_SQ_NIC_VEB_M VIRTCHNL2_RXDID_M(4_FLEX_SQ_NIC_VEB) +#define VIRTCHNL2_RXDID_5_FLEX_SQ_NIC_ACL_M VIRTCHNL2_RXDID_M(5_FLEX_SQ_NIC_ACL) +#define VIRTCHNL2_RXDID_6_FLEX_SQ_NIC_2_M VIRTCHNL2_RXDID_M(6_FLEX_SQ_NIC_2) +#define VIRTCHNL2_RXDID_7_HW_RSVD_MVIRTCHNL2_RXDID_M(7_HW_RSVD) /* 9 through 15 are reserved */ -#define VIRTCHNL2_RXDID_16_COMMS_GENERIC_M BIT(VIRTCHNL2_RXDID_16_COMMS_GENERIC) -#define VIRTCHNL2_RXDID_17_COMMS_AUX_VLAN_M BIT(VIRTCHNL2_RXDID_17_COMMS_AUX_VLAN) -#define VIRTCHNL2_RXDID_18_COMMS_AUX_IPV4_M BIT(VIRTCHNL2_RXDID_18_COMMS_AUX_IPV4) -#define VIRTCHNL2_RXDID_19_COMMS_AUX_IPV6_M BIT(VIRTCHNL2_RXDID_19_COMMS_AUX_IPV6) -#define VIRTCHNL2_RXDID_20_COMMS_AUX_FLOW_M BIT(VIRTCHNL2_RXDID_20_COMMS_AUX_FLOW) -#define VIRTCHNL2_RXDID_21_COMMS_AUX_TCP_M BIT(VIRTCHNL2_RXDID_21_COMMS_AUX_TCP) +#define VIRTCHNL2_RXDID_16_COMMS_GENERIC_M VIRTCHNL2_RXDID_M(16_COMMS_GENERIC) +#define VIRTCHNL2_RXDID_17_COMMS_AUX_VLAN_M VIRTCHNL2_RXDID_M(17_COMMS_AUX_VLAN) +#define VIRTCHNL2_RXDID_18_COMMS_AUX_IPV4_M VIRTCHNL2_RXDID_M(18_COMMS_AUX_IPV4) +#define VIRTCHNL2_RXDID_19_COMMS_AUX_IPV6_M VIRTCHNL2_RXDID_M(19_COMMS_AUX_IPV6) +#define VIRTCHNL2_RXDID_20_COMMS_AUX_FLOW_M VIRTCHNL2_RXDID_M(20_COMMS_AUX_FLOW) +#define VIRTCHNL2_RXDID_21_COMMS_AUX_TCP_M VIRTCHNL2_RXDID_M(21_COMMS_AUX_TCP) /* 22 through 63 are reserved */ /* Rx */ -- 2.43.0
[PATCH v5 08/21] common/idpf: refactor size check macro
Instead of using 'divide by 0' to check the struct length, use the static_assert macro Removed redundant CHECK_UNION_LEN macro. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 1f59730297..f8b97f2e06 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -41,15 +41,12 @@ /* State Machine error - Command sequence problem */ #defineVIRTCHNL2_STATUS_ERR_ESM201 -/* These macros are used to generate compilation errors if a structure/union - * is not exactly the correct length. It gives a divide by zero error if the - * structure/union is not of the correct size, otherwise it creates an enum - * that is never used. +/* This macro is used to generate compilation errors if a structure + * is not exactly the correct length. */ -#define VIRTCHNL2_CHECK_STRUCT_LEN(n, X) enum virtchnl2_static_assert_enum_##X \ - { virtchnl2_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) } -#define VIRTCHNL2_CHECK_UNION_LEN(n, X) enum virtchnl2_static_asset_enum_##X \ - { virtchnl2_static_assert_##X = (n)/((sizeof(union X) == (n)) ? 1 : 0) } +#define VIRTCHNL2_CHECK_STRUCT_LEN(n, X) \ + static_assert((n) == sizeof(struct X), \ + "Structure length does not match with the expected value") /* New major set of opcodes introduced and so leaving room for * old misc opcodes to be added in future. Also these opcodes may only -- 2.43.0
[PATCH v5 09/21] common/idpf: update mask of Rx FLEX DESC ADV FF1 M
Mask for VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_M was defined wrongly and this patch fixes it. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2_lan_desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/idpf/base/virtchnl2_lan_desc.h b/drivers/common/idpf/base/virtchnl2_lan_desc.h index f632271788..9e04cf8628 100644 --- a/drivers/common/idpf/base/virtchnl2_lan_desc.h +++ b/drivers/common/idpf/base/virtchnl2_lan_desc.h @@ -111,7 +111,7 @@ BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_SPH_S) #define VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_S 12 #define VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_M \ - IDPF_M(0x7UL, VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_M) + IDPF_M(0x7UL, VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_S) #define VIRTCHNL2_RX_FLEX_DESC_ADV_MISS_S 15 #define VIRTCHNL2_RX_FLEX_DESC_ADV_MISS_M \ BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_MISS_S) -- 2.43.0
[PATCH v5 12/21] common/idpf: avoid variable 0-init
Don't initialize the variables if not needed. Also use 'err' instead of 'status', 'ret_code', 'ret' etc. for consistency and change the return label 'sq_send_command_out' to 'err_unlock'. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_controlq.c | 60 +-- .../common/idpf/base/idpf_controlq_setup.c| 18 +++--- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c index d9ca33cdb9..65e5599614 100644 --- a/drivers/common/idpf/base/idpf_controlq.c +++ b/drivers/common/idpf/base/idpf_controlq.c @@ -61,7 +61,7 @@ static void idpf_ctlq_init_regs(struct idpf_hw *hw, struct idpf_ctlq_info *cq, */ static void idpf_ctlq_init_rxq_bufs(struct idpf_ctlq_info *cq) { - int i = 0; + int i; for (i = 0; i < cq->ring_size; i++) { struct idpf_ctlq_desc *desc = IDPF_CTLQ_DESC(cq, i); @@ -134,7 +134,7 @@ int idpf_ctlq_add(struct idpf_hw *hw, { struct idpf_ctlq_info *cq; bool is_rxq = false; - int status = 0; + int err; if (!qinfo->len || !qinfo->buf_size || qinfo->len > IDPF_CTLQ_MAX_RING_SIZE || @@ -160,14 +160,14 @@ int idpf_ctlq_add(struct idpf_hw *hw, is_rxq = true; /* fallthrough */ case IDPF_CTLQ_TYPE_MAILBOX_TX: - status = idpf_ctlq_alloc_ring_res(hw, cq); + err = idpf_ctlq_alloc_ring_res(hw, cq); break; default: - status = -EINVAL; + err = -EINVAL; break; } - if (status) + if (err) goto init_free_q; if (is_rxq) { @@ -178,7 +178,7 @@ int idpf_ctlq_add(struct idpf_hw *hw, idpf_calloc(hw, qinfo->len, sizeof(struct idpf_ctlq_msg *)); if (!cq->bi.tx_msg) { - status = -ENOMEM; + err = -ENOMEM; goto init_dealloc_q_mem; } } @@ -192,7 +192,7 @@ int idpf_ctlq_add(struct idpf_hw *hw, LIST_INSERT_HEAD(&hw->cq_list_head, cq, cq_list); *cq_out = cq; - return status; + return 0; init_dealloc_q_mem: /* free ring buffers and the ring itself */ @@ -201,7 +201,7 @@ int idpf_ctlq_add(struct idpf_hw *hw, idpf_free(hw, cq); cq = NULL; - return status; + return err; } /** @@ -232,27 +232,27 @@ int idpf_ctlq_init(struct idpf_hw *hw, u8 num_q, struct idpf_ctlq_create_info *q_info) { struct idpf_ctlq_info *cq = NULL, *tmp = NULL; - int ret_code = 0; - int i = 0; + int err; + int i; LIST_INIT(&hw->cq_list_head); for (i = 0; i < num_q; i++) { struct idpf_ctlq_create_info *qinfo = q_info + i; - ret_code = idpf_ctlq_add(hw, qinfo, &cq); - if (ret_code) + err = idpf_ctlq_add(hw, qinfo, &cq); + if (err) goto init_destroy_qs; } - return ret_code; + return 0; init_destroy_qs: LIST_FOR_EACH_ENTRY_SAFE(cq, tmp, &hw->cq_list_head, idpf_ctlq_info, cq_list) idpf_ctlq_remove(hw, cq); - return ret_code; + return err; } /** @@ -286,9 +286,9 @@ int idpf_ctlq_send(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg, struct idpf_ctlq_msg q_msg[]) { struct idpf_ctlq_desc *desc; - int num_desc_avail = 0; - int status = 0; - int i = 0; + int num_desc_avail; + int err = 0; + int i; if (!cq || !cq->ring_size) return -ENOBUFS; @@ -298,8 +298,8 @@ int idpf_ctlq_send(struct idpf_hw *hw, struct idpf_ctlq_info *cq, /* Ensure there are enough descriptors to send all messages */ num_desc_avail = IDPF_CTLQ_DESC_UNUSED(cq); if (num_desc_avail == 0 || num_desc_avail < num_q_msg) { - status = -ENOSPC; - goto sq_send_command_out; + err = -ENOSPC; + goto err_unlock; } for (i = 0; i < num_q_msg; i++) { @@ -370,10 +370,10 @@ int idpf_ctlq_send(struct idpf_hw *hw, struct idpf_ctlq_info *cq, wr32(hw, cq->reg.tail, cq->next_to_use); -sq_send_command_out: +err_unlock: idpf_release_lock(&cq->cq_lock); - return status; + return err; } /** @@ -397,9 +397,8 @@ static int __idpf_ctlq_clean_sq(struct idpf_ctlq_info *cq, u16 *clean_count, struct idpf_ctlq_msg *msg_status[], bool force) { struct idpf_ctlq_desc *desc; - u16 i = 0, num_to_clean; + u16 i, num_to_clean; u16 ntc, desc_err; - int ret = 0; if (!cq || !cq->ring_size) return -ENOBUFS; @@ -446,7 +4
[PATCH v5 13/21] common/idpf: update in PTP message validation
When the message for getting timestamp latches is sent by the driver, number of latches is equal to 0. Current implementation of message validation function incorrectly notifies this kind of message length as invalid. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index e76ccbd46f..24a8b37876 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -2272,7 +2272,7 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 case VIRTCHNL2_OP_GET_PTP_CAPS: valid_len = sizeof(struct virtchnl2_get_ptp_caps); - if (msglen >= valid_len) { + if (msglen > valid_len) { struct virtchnl2_get_ptp_caps *ptp_caps = (struct virtchnl2_get_ptp_caps *)msg; @@ -2288,7 +2288,7 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES: valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches); - if (msglen >= valid_len) { + if (msglen > valid_len) { struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches = (struct virtchnl2_ptp_tx_tstamp_latches *)msg; -- 2.43.0
[PATCH v5 14/21] common/idpf: rename INLINE FLOW STEER to FLOW STEER
This capability bit indicates both inline as well as side band flow steering capability. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 24a8b37876..9dd5191c0e 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -243,7 +243,7 @@ enum virtchnl2_cap_other { VIRTCHNL2_CAP_FLOW_DIRECTOR = BIT_ULL(3), VIRTCHNL2_CAP_SPLITQ_QSCHED = BIT_ULL(4), VIRTCHNL2_CAP_CRC = BIT_ULL(5), - VIRTCHNL2_CAP_INLINE_FLOW_STEER = BIT_ULL(6), + VIRTCHNL2_CAP_FLOW_STEER= BIT_ULL(6), VIRTCHNL2_CAP_WB_ON_ITR = BIT_ULL(7), VIRTCHNL2_CAP_PROMISC = BIT_ULL(8), VIRTCHNL2_CAP_LINK_SPEED= BIT_ULL(9), -- 2.43.0
[PATCH v5 15/21] common/idpf: add wmb before tail
Introduced through customer's feedback in their attempt to address some bugs this introduces a memory barrier before posting ctlq tail. This makes sure memory writes have a chance to take place before HW starts messing with the descriptors. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_controlq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c index 65e5599614..4f47759a4f 100644 --- a/drivers/common/idpf/base/idpf_controlq.c +++ b/drivers/common/idpf/base/idpf_controlq.c @@ -604,6 +604,8 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq, /* Wrap to end of end ring since current ntp is 0 */ cq->next_to_post = cq->ring_size - 1; + idpf_wmb(); + wr32(hw, cq->reg.tail, cq->next_to_post); } -- 2.43.0
[PATCH v5 16/21] drivers: add flex array support and fix issues
With the internal Linux upstream feedback that is received on IDPF driver and also some references available online, it is discouraged to use 1-sized array fields in the structures, especially in the new Linux drivers that are going to be upstreamed. Instead, it is recommended to use flex array fields for the dynamic sized structures. Some fixes based on code change is introduced to compile dpdk. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 466 - drivers/common/idpf/idpf_common_virtchnl.c | 2 +- drivers/net/cpfl/cpfl_ethdev.c | 28 +- 3 files changed, 86 insertions(+), 410 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 9dd5191c0e..317bd06c0f 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -63,6 +63,10 @@ enum virtchnl2_status { #define VIRTCHNL2_CHECK_STRUCT_LEN(n, X) \ static_assert((n) == sizeof(struct X), \ "Structure length does not match with the expected value") +#define VIRTCHNL2_CHECK_STRUCT_VAR_LEN(n, X, T)\ + VIRTCHNL2_CHECK_STRUCT_LEN(n, X) + +#define STRUCT_VAR_LEN 1 /** * New major set of opcodes introduced and so leaving room for @@ -696,10 +700,9 @@ VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_queue_reg_chunk); struct virtchnl2_queue_reg_chunks { __le16 num_chunks; u8 pad[6]; - struct virtchnl2_queue_reg_chunk chunks[1]; + struct virtchnl2_queue_reg_chunk chunks[STRUCT_VAR_LEN]; }; - -VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_queue_reg_chunks); +VIRTCHNL2_CHECK_STRUCT_VAR_LEN(40, virtchnl2_queue_reg_chunks, chunks); /** * enum virtchnl2_vport_flags - Vport flags @@ -773,7 +776,7 @@ struct virtchnl2_create_vport { u8 pad[20]; struct virtchnl2_queue_reg_chunks chunks; }; -VIRTCHNL2_CHECK_STRUCT_LEN(192, virtchnl2_create_vport); +VIRTCHNL2_CHECK_STRUCT_VAR_LEN(192, virtchnl2_create_vport, chunks.chunks); /** * struct virtchnl2_vport - Vport identifier information @@ -860,10 +863,9 @@ struct virtchnl2_config_tx_queues { __le16 num_qinfo; u8 pad[10]; - struct virtchnl2_txq_info qinfo[1]; + struct virtchnl2_txq_info qinfo[STRUCT_VAR_LEN]; }; - -VIRTCHNL2_CHECK_STRUCT_LEN(72, virtchnl2_config_tx_queues); +VIRTCHNL2_CHECK_STRUCT_VAR_LEN(72, virtchnl2_config_tx_queues, qinfo); /** * struct virtchnl2_rxq_info - Receive queue config info @@ -942,10 +944,9 @@ struct virtchnl2_config_rx_queues { __le16 num_qinfo; u8 pad[18]; - struct virtchnl2_rxq_info qinfo[1]; + struct virtchnl2_rxq_info qinfo[STRUCT_VAR_LEN]; }; - -VIRTCHNL2_CHECK_STRUCT_LEN(112, virtchnl2_config_rx_queues); +VIRTCHNL2_CHECK_STRUCT_VAR_LEN(112, virtchnl2_config_rx_queues, qinfo); /** * struct virtchnl2_add_queues - Data for VIRTCHNL2_OP_ADD_QUEUES @@ -975,16 +976,15 @@ struct virtchnl2_add_queues { struct virtchnl2_queue_reg_chunks chunks; }; - -VIRTCHNL2_CHECK_STRUCT_LEN(56, virtchnl2_add_queues); +VIRTCHNL2_CHECK_STRUCT_VAR_LEN(56, virtchnl2_add_queues, chunks.chunks); /* Queue Groups Extension */ /** * struct virtchnl2_rx_queue_group_info - RX queue group info - * @rss_lut_size: IN/OUT, user can ask to update rss_lut size originally - * allocated by CreateVport command. New size will be returned - * if allocation succeeded, otherwise original rss_size from - * CreateVport will be returned. + * @rss_lut_size: User can ask to update rss_lut size originally allocated by + * CreateVport command. New size will be returned if allocation + * succeeded, otherwise original rss_size from CreateVport + * will be returned. * @pad: Padding for future extensions */ struct virtchnl2_rx_queue_group_info { @@ -1012,7 +1012,7 @@ VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_rx_queue_group_info); * @cir_pad: Future extension purpose for CIR only * @pad2: Padding for future extensions */ -struct virtchnl2_tx_queue_group_info { /* IN */ +struct virtchnl2_tx_queue_group_info { u8 tx_tc; u8 priority; u8 is_sp; @@ -1045,19 +1045,17 @@ VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_queue_group_id); /** * struct virtchnl2_queue_group_info - Queue group info * @qg_id: Queue group ID - * @num_tx_q: Number of TX queues - * @num_tx_complq: Number of completion queues - * @num_rx_q: Number of RX queues - * @num_rx_bufq: Number of RX buffer queues + * @num_tx_q: Number of TX queues requested + * @num_tx_complq: Number of completion queues requested + * @num_rx_q: Number of RX queues requested + * @num_rx_bufq: Number of RX buffer queues requested * @tx_q_grp_info: TX queue group info * @rx_q_grp_info: RX queue group info * @pad: Padding for future extensions - * @chunks: Queue register chunks + * @chunks: Queue register chunks from CP */ struct virtch
[PATCH v5 17/21] common/idpf: enable flow steer capability for vports
Added virtchnl2_flow_types to be used for flow steering. Added flow steer cap flags for vport create. Add flow steer flow types and action types for vport create. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 60 ++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 317bd06c0f..c14a4e2c7d 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -269,6 +269,43 @@ enum virtchnl2_cap_other { VIRTCHNL2_CAP_OEM = BIT_ULL(63), }; +/** + * enum virtchnl2_action_types - Available actions for sideband flow steering + * @VIRTCHNL2_ACTION_DROP: Drop the packet + * @VIRTCHNL2_ACTION_PASSTHRU: Forward the packet to the next classifier/stage + * @VIRTCHNL2_ACTION_QUEUE: Forward the packet to a receive queue + * @VIRTCHNL2_ACTION_Q_GROUP: Forward the packet to a receive queue group + * @VIRTCHNL2_ACTION_MARK: Mark the packet with specific marker value + * @VIRTCHNL2_ACTION_COUNT: Increment the corresponding counter + */ + +enum virtchnl2_action_types { + VIRTCHNL2_ACTION_DROP = BIT(0), + VIRTCHNL2_ACTION_PASSTHRU = BIT(1), + VIRTCHNL2_ACTION_QUEUE = BIT(2), + VIRTCHNL2_ACTION_Q_GROUP= BIT(3), + VIRTCHNL2_ACTION_MARK = BIT(4), + VIRTCHNL2_ACTION_COUNT = BIT(5), +}; + +/* Flow type capabilities for Flow Steering and Receive-Side Scaling */ +enum virtchnl2_flow_types { + VIRTCHNL2_FLOW_IPV4_TCP = BIT(0), + VIRTCHNL2_FLOW_IPV4_UDP = BIT(1), + VIRTCHNL2_FLOW_IPV4_SCTP= BIT(2), + VIRTCHNL2_FLOW_IPV4_OTHER = BIT(3), + VIRTCHNL2_FLOW_IPV6_TCP = BIT(4), + VIRTCHNL2_FLOW_IPV6_UDP = BIT(5), + VIRTCHNL2_FLOW_IPV6_SCTP= BIT(6), + VIRTCHNL2_FLOW_IPV6_OTHER = BIT(7), + VIRTCHNL2_FLOW_IPV4_AH = BIT(8), + VIRTCHNL2_FLOW_IPV4_ESP = BIT(9), + VIRTCHNL2_FLOW_IPV4_AH_ESP = BIT(10), + VIRTCHNL2_FLOW_IPV6_AH = BIT(11), + VIRTCHNL2_FLOW_IPV6_ESP = BIT(12), + VIRTCHNL2_FLOW_IPV6_AH_ESP = BIT(13), +}; + /** * enum virtchnl2_txq_sched_mode - Transmit Queue Scheduling Modes * @VIRTCHNL2_TXQ_SCHED_MODE_QUEUE: Queue mode is the legacy mode i.e. inorder @@ -707,11 +744,16 @@ VIRTCHNL2_CHECK_STRUCT_VAR_LEN(40, virtchnl2_queue_reg_chunks, chunks); /** * enum virtchnl2_vport_flags - Vport flags * @VIRTCHNL2_VPORT_UPLINK_PORT: Uplink port flag - * @VIRTCHNL2_VPORT_INLINE_FLOW_STEER_ENA: Inline flow steering enable flag + * @VIRTCHNL2_VPORT_INLINE_FLOW_STEER: Inline flow steering enabled + * @VIRTCHNL2_VPORT_INLINE_FLOW_STEER_RXQ: Inline flow steering enabled + * with explicit Rx queue action + * @VIRTCHNL2_VPORT_SIDEBAND_FLOW_STEER: Sideband flow steering enabled */ enum virtchnl2_vport_flags { VIRTCHNL2_VPORT_UPLINK_PORT = BIT(0), - VIRTCHNL2_VPORT_INLINE_FLOW_STEER_ENA = BIT(1), + VIRTCHNL2_VPORT_INLINE_FLOW_STEER = BIT(1), + VIRTCHNL2_VPORT_INLINE_FLOW_STEER_RXQ = BIT(2), + VIRTCHNL2_VPORT_SIDEBAND_FLOW_STEER = BIT(3), }; #define VIRTCHNL2_ETH_LENGTH_OF_ADDRESS 6 @@ -739,6 +781,14 @@ enum virtchnl2_vport_flags { * @rx_desc_ids: See enum virtchnl2_rx_desc_id_bitmasks * @tx_desc_ids: See enum virtchnl2_tx_desc_ids * @reserved: Reserved bytes and cannot be used + * @inline_flow_types: Bit mask of supported inline-flow-steering + * flow types (See enum virtchnl2_flow_types) + * @sideband_flow_types: Bit mask of supported sideband-flow-steering + * flow types (See enum virtchnl2_flow_types) + * @sideband_flow_actions: Bit mask of supported action types + * for sideband flow steering (See enum virtchnl2_action_types) + * @flow_steer_max_rules: Max rules allowed for inline and sideband + * flow steering combined * @rss_algorithm: RSS algorithm * @rss_key_size: RSS key size * @rss_lut_size: RSS LUT size @@ -768,7 +818,11 @@ struct virtchnl2_create_vport { __le16 vport_flags; __le64 rx_desc_ids; __le64 tx_desc_ids; - u8 reserved[72]; + u8 reserved[48]; + __le64 inline_flow_types; + __le64 sideband_flow_types; + __le32 sideband_flow_actions; + __le32 flow_steer_max_rules; __le32 rss_algorithm; __le16 rss_key_size; __le16 rss_lut_size; -- 2.43.0
[PATCH v5 10/21] common/idpf: use 'pad' and 'reserved' fields appropriately
'pad' naming is used if the field is actually a padding byte and is also used for bytes meant for future addition of new fields, whereas 'reserved' is only used if the field is reserved and cannot be used for any other purpose. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 71 +++- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index f8b97f2e06..d007c2f540 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -95,7 +95,7 @@ #defineVIRTCHNL2_OP_ADD_QUEUE_GROUPS 538 #defineVIRTCHNL2_OP_DEL_QUEUE_GROUPS 539 #defineVIRTCHNL2_OP_GET_PORT_STATS 540 - /* TimeSync opcodes */ +/* TimeSync opcodes */ #defineVIRTCHNL2_OP_GET_PTP_CAPS 541 #defineVIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES 542 @@ -559,7 +559,7 @@ struct virtchnl2_get_capabilities { /* max number of header buffers that can be used for an LSO */ u8 max_hdr_buf_per_lso; - u8 reserved[10]; + u8 pad1[10]; }; VIRTCHNL2_CHECK_STRUCT_LEN(80, virtchnl2_get_capabilities); @@ -575,7 +575,7 @@ struct virtchnl2_queue_reg_chunk { __le64 qtail_reg_start; __le32 qtail_reg_spacing; - u8 reserved[4]; + u8 pad1[4]; }; VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_queue_reg_chunk); @@ -583,7 +583,7 @@ VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_queue_reg_chunk); /* structure to specify several chunks of contiguous queues */ struct virtchnl2_queue_reg_chunks { __le16 num_chunks; - u8 reserved[6]; + u8 pad[6]; struct virtchnl2_queue_reg_chunk chunks[1]; }; @@ -648,7 +648,7 @@ struct virtchnl2_create_vport { /* see VIRTCHNL2_HEADER_SPLIT_CAPS definitions */ __le32 rx_split_pos; - u8 reserved[20]; + u8 pad2[20]; struct virtchnl2_queue_reg_chunks chunks; }; @@ -663,7 +663,7 @@ VIRTCHNL2_CHECK_STRUCT_LEN(192, virtchnl2_create_vport); */ struct virtchnl2_vport { __le32 vport_id; - u8 reserved[4]; + u8 pad[4]; }; VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_vport); @@ -708,7 +708,7 @@ struct virtchnl2_txq_info { __le32 egress_hdr_pasid; __le32 egress_buf_pasid; - u8 reserved[8]; + u8 pad1[8]; }; VIRTCHNL2_CHECK_STRUCT_LEN(56, virtchnl2_txq_info); @@ -724,7 +724,7 @@ struct virtchnl2_config_tx_queues { __le32 vport_id; __le16 num_qinfo; - u8 reserved[10]; + u8 pad[10]; struct virtchnl2_txq_info qinfo[1]; }; @@ -749,7 +749,7 @@ struct virtchnl2_rxq_info { __le16 ring_len; u8 buffer_notif_stride; - u8 pad[1]; + u8 pad; /* Applicable only for receive buffer queues */ __le64 dma_head_wb_addr; @@ -768,16 +768,15 @@ struct virtchnl2_rxq_info { * if this field is set */ u8 bufq2_ena; - u8 pad2[3]; + u8 pad1[3]; /* Ingress pasid is used for SIOV use case */ __le32 ingress_pasid; __le32 ingress_hdr_pasid; __le32 ingress_buf_pasid; - u8 reserved[16]; + u8 pad2[16]; }; - VIRTCHNL2_CHECK_STRUCT_LEN(88, virtchnl2_rxq_info); /* VIRTCHNL2_OP_CONFIG_RX_QUEUES @@ -791,7 +790,7 @@ struct virtchnl2_config_rx_queues { __le32 vport_id; __le16 num_qinfo; - u8 reserved[18]; + u8 pad[18]; struct virtchnl2_rxq_info qinfo[1]; }; @@ -810,7 +809,8 @@ struct virtchnl2_add_queues { __le16 num_tx_complq; __le16 num_rx_q; __le16 num_rx_bufq; - u8 reserved[4]; + u8 pad[4]; + struct virtchnl2_queue_reg_chunks chunks; }; @@ -948,7 +948,7 @@ struct virtchnl2_vector_chunk { __le16 start_vector_id; __le16 start_evv_id; __le16 num_vectors; - __le16 pad1; + __le16 pad; /* Register offsets and spacing provided by CP. * dynamic control registers are used for enabling/disabling/re-enabling @@ -969,15 +969,15 @@ struct virtchnl2_vector_chunk { * where n=0..2 */ __le32 itrn_index_spacing; - u8 reserved[4]; + u8 pad1[4]; }; - VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_vector_chunk); /* Structure to specify several chunks of contiguous interrupt vectors */ struct virtchnl2_vector_chunks { __le16 num_vchunks; - u8 reserved[14]; + u8 pad[14]; + struct virtchnl2_vector_chunk vchunks[1]; }; @@ -992,7 +992,8 @@ VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_vector_chunks); */ struct virtchnl2_alloc_vectors { __le16 num_vectors; - u8 reserved[14]; + u8 pad[14]; + struct virtchnl2_vector_chunks vchunks; }; @@ -1014,8 +1015,9 @@ struct virtchnl2_rss_lut { __le32 vport_id; __le16 lut_entries_start;
[PATCH v5 11/21] common/idpf: move related defines into enums
Changes all groups of related defines to enums. The names of the enums are chosen to follow the common part of the naming pattern as much as possible. Replaced the common labels from the comments with the enum names. While at it, modify header description based on upstream feedback. Some variable names modified and comments updated in descriptive way. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 1847 ++--- drivers/common/idpf/base/virtchnl2_lan_desc.h | 843 +--- 2 files changed, 1686 insertions(+), 1004 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index d007c2f540..e76ccbd46f 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -8,317 +8,396 @@ /* All opcodes associated with virtchnl 2 are prefixed with virtchnl2 or * VIRTCHNL2. Any future opcodes, offloads/capabilities, structures, * and defines must be prefixed with virtchnl2 or VIRTCHNL2 to avoid confusion. + * + * PF/VF uses the virtchnl interface defined in this header file to communicate + * with device Control Plane (CP). Driver and the CP may run on different + * platforms with different endianness. To avoid byte order discrepancies, + * all the structures in this header follow little-endian format. + * + * This is an interface definition file where existing enums and their values + * must remain unchanged over time, so we specify explicit values for all enums. */ #include "virtchnl2_lan_desc.h" -/* VIRTCHNL2_ERROR_CODES */ -/* success */ -#defineVIRTCHNL2_STATUS_SUCCESS0 -/* Operation not permitted, used in case of command not permitted for sender */ -#defineVIRTCHNL2_STATUS_ERR_EPERM 1 -/* Bad opcode - virtchnl interface problem */ -#defineVIRTCHNL2_STATUS_ERR_ESRCH 3 -/* I/O error - HW access error */ -#defineVIRTCHNL2_STATUS_ERR_EIO5 -/* No such resource - Referenced resource is not allacated */ -#defineVIRTCHNL2_STATUS_ERR_ENXIO 6 -/* Permission denied - Resource is not permitted to caller */ -#defineVIRTCHNL2_STATUS_ERR_EACCES 13 -/* Device or resource busy - In case shared resource is in use by others */ -#defineVIRTCHNL2_STATUS_ERR_EBUSY 16 -/* Object already exists and not free */ -#defineVIRTCHNL2_STATUS_ERR_EEXIST 17 -/* Invalid input argument in command */ -#defineVIRTCHNL2_STATUS_ERR_EINVAL 22 -/* No space left or allocation failure */ -#defineVIRTCHNL2_STATUS_ERR_ENOSPC 28 -/* Parameter out of range */ -#defineVIRTCHNL2_STATUS_ERR_ERANGE 34 - -/* Op not allowed in current dev mode */ -#defineVIRTCHNL2_STATUS_ERR_EMODE 200 -/* State Machine error - Command sequence problem */ -#defineVIRTCHNL2_STATUS_ERR_ESM201 - -/* This macro is used to generate compilation errors if a structure +/** + * enum virtchnl2_status - Error codes. + * @VIRTCHNL2_STATUS_SUCCESS: Success + * @VIRTCHNL2_STATUS_ERR_EPERM: Operation not permitted, used in case of command + * not permitted for sender + * @VIRTCHNL2_STATUS_ERR_ESRCH: Bad opcode - virtchnl interface problem + * @VIRTCHNL2_STATUS_ERR_EIO: I/O error - HW access error + * @VIRTCHNL2_STATUS_ERR_ENXIO: No such resource - Referenced resource is not + * allocated + * @VIRTCHNL2_STATUS_ERR_EACCES: Permission denied - Resource is not permitted + * to caller + * @VIRTCHNL2_STATUS_ERR_EBUSY: Device or resource busy - In case shared + * resource is in use by others + * @VIRTCHNL2_STATUS_ERR_EEXIST: Object already exists and not free + * @VIRTCHNL2_STATUS_ERR_EINVAL: Invalid input argument in command + * @VIRTCHNL2_STATUS_ERR_ENOSPC: No space left or allocation failure + * @VIRTCHNL2_STATUS_ERR_ERANGE: Parameter out of range + * @VIRTCHNL2_STATUS_ERR_EMODE: Operation not allowed in current dev mode + * @VIRTCHNL2_STATUS_ERR_ESM: State Machine error - Command sequence problem + */ +enum virtchnl2_status { + VIRTCHNL2_STATUS_SUCCESS= 0, + VIRTCHNL2_STATUS_ERR_EPERM = 1, + VIRTCHNL2_STATUS_ERR_ESRCH = 3, + VIRTCHNL2_STATUS_ERR_EIO= 5, + VIRTCHNL2_STATUS_ERR_ENXIO = 6, + VIRTCHNL2_STATUS_ERR_EACCES = 13, + VIRTCHNL2_STATUS_ERR_EBUSY = 16, + VIRTCHNL2_STATUS_ERR_EEXIST = 17, + VIRTCHNL2_STATUS_ERR_EINVAL = 22, + VIRTCHNL2_STATUS_ERR_ENOSPC = 28, + VIRTCHNL2_STATUS_ERR_ERANGE = 34, + VIRTCHNL2_STATUS_ERR_EMODE = 200, + VIRTCHNL2_STATUS_ERR_ESM= 201, +}; + +/** + * This macro is used to generate compilation errors if a structure * is not exactly the correct length. */ #define VIRTCHNL2_CHECK_STRUCT_LEN(n, X) \ static_assert((n) == sizeof(struct X), \ "Structure length does not
[PATCH v5 18/21] common/idpf: add a new Tx context descriptor structure
Adding a new structure for the context descriptor that contains the support for timesync packets, where the index for timestamping is set. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_lan_txrx.h | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/common/idpf/base/idpf_lan_txrx.h b/drivers/common/idpf/base/idpf_lan_txrx.h index c9eaeb5d3f..be27973a33 100644 --- a/drivers/common/idpf/base/idpf_lan_txrx.h +++ b/drivers/common/idpf/base/idpf_lan_txrx.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2001-2023 Intel Corporation + * Copyright(c) 2001-2024 Intel Corporation */ #ifndef _IDPF_LAN_TXRX_H_ @@ -286,6 +286,24 @@ struct idpf_flex_tx_tso_ctx_qw { }; union idpf_flex_tx_ctx_desc { + /* DTYPE = IDPF_TX_DESC_DTYPE_CTX (0x01) */ + struct { + struct { + u8 rsv[4]; + __le16 l2tag2; + u8 rsv_2[2]; + } qw0; + struct { + __le16 cmd_dtype; + __le16 tsyn_reg_l; +#define IDPF_TX_DESC_CTX_TSYN_L_M GENMASK(15, 14) + __le16 tsyn_reg_h; +#define IDPF_TX_DESC_CTX_TSYN_H_M GENMASK(15, 0) + __le16 mss; +#define IDPF_TX_DESC_CTX_MSS_M GENMASK(14, 2) + } qw1; + } tsyn; + /* DTYPE = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX (0x05) */ struct { struct idpf_flex_tx_tso_ctx_qw qw0; -- 2.43.0
[PATCH v5 19/21] common/idpf: remove idpf common file
The file is redundant in our implementation and is not required further. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_common.c | 382 - drivers/common/idpf/base/meson.build | 1 - 2 files changed, 383 deletions(-) delete mode 100644 drivers/common/idpf/base/idpf_common.c diff --git a/drivers/common/idpf/base/idpf_common.c b/drivers/common/idpf/base/idpf_common.c deleted file mode 100644 index bb540345c2..00 --- a/drivers/common/idpf/base/idpf_common.c +++ /dev/null @@ -1,382 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2001-2024 Intel Corporation - */ - -#include "idpf_prototype.h" -#include "idpf_type.h" -#include - - -/** - * idpf_set_mac_type - Sets MAC type - * @hw: pointer to the HW structure - * - * This function sets the mac type of the adapter based on the - * vendor ID and device ID stored in the hw structure. - */ -int idpf_set_mac_type(struct idpf_hw *hw) -{ - int status = 0; - - DEBUGFUNC("Set MAC type\n"); - - if (hw->vendor_id == IDPF_INTEL_VENDOR_ID) { - switch (hw->device_id) { - case IDPF_DEV_ID_PF: - hw->mac.type = IDPF_MAC_PF; - break; - case IDPF_DEV_ID_VF: - hw->mac.type = IDPF_MAC_VF; - break; - default: - hw->mac.type = IDPF_MAC_GENERIC; - break; - } - } else { - status = -ENODEV; - } - - DEBUGOUT2("Setting MAC type found mac: %d, returns: %d\n", - hw->mac.type, status); - return status; -} - -/** - * idpf_init_hw - main initialization routine - * @hw: pointer to the hardware structure - * @ctlq_size: struct to pass ctlq size data - */ -int idpf_init_hw(struct idpf_hw *hw, struct idpf_ctlq_size ctlq_size) -{ - struct idpf_ctlq_create_info *q_info; - int status = 0; - struct idpf_ctlq_info *cq = NULL; - - /* Setup initial control queues */ - q_info = (struct idpf_ctlq_create_info *) -idpf_calloc(hw, 2, sizeof(struct idpf_ctlq_create_info)); - if (!q_info) - return -ENOMEM; - - q_info[0].type = IDPF_CTLQ_TYPE_MAILBOX_TX; - q_info[0].buf_size = ctlq_size.asq_buf_size; - q_info[0].len = ctlq_size.asq_ring_size; - q_info[0].id = -1; /* default queue */ - - if (hw->mac.type == IDPF_MAC_PF) { - q_info[0].reg.head = PF_FW_ATQH; - q_info[0].reg.tail = PF_FW_ATQT; - q_info[0].reg.len = PF_FW_ATQLEN; - q_info[0].reg.bah = PF_FW_ATQBAH; - q_info[0].reg.bal = PF_FW_ATQBAL; - q_info[0].reg.len_mask = PF_FW_ATQLEN_ATQLEN_M; - q_info[0].reg.len_ena_mask = PF_FW_ATQLEN_ATQENABLE_M; - q_info[0].reg.head_mask= PF_FW_ATQH_ATQH_M; - } else { - q_info[0].reg.head = VF_ATQH; - q_info[0].reg.tail = VF_ATQT; - q_info[0].reg.len = VF_ATQLEN; - q_info[0].reg.bah = VF_ATQBAH; - q_info[0].reg.bal = VF_ATQBAL; - q_info[0].reg.len_mask = VF_ATQLEN_ATQLEN_M; - q_info[0].reg.len_ena_mask = VF_ATQLEN_ATQENABLE_M; - q_info[0].reg.head_mask= VF_ATQH_ATQH_M; - } - - q_info[1].type = IDPF_CTLQ_TYPE_MAILBOX_RX; - q_info[1].buf_size = ctlq_size.arq_buf_size; - q_info[1].len = ctlq_size.arq_ring_size; - q_info[1].id = -1; /* default queue */ - - if (hw->mac.type == IDPF_MAC_PF) { - q_info[1].reg.head = PF_FW_ARQH; - q_info[1].reg.tail = PF_FW_ARQT; - q_info[1].reg.len = PF_FW_ARQLEN; - q_info[1].reg.bah = PF_FW_ARQBAH; - q_info[1].reg.bal = PF_FW_ARQBAL; - q_info[1].reg.len_mask = PF_FW_ARQLEN_ARQLEN_M; - q_info[1].reg.len_ena_mask = PF_FW_ARQLEN_ARQENABLE_M; - q_info[1].reg.head_mask= PF_FW_ARQH_ARQH_M; - } else { - q_info[1].reg.head = VF_ARQH; - q_info[1].reg.tail = VF_ARQT; - q_info[1].reg.len = VF_ARQLEN; - q_info[1].reg.bah = VF_ARQBAH; - q_info[1].reg.bal = VF_ARQBAL; - q_info[1].reg.len_mask = VF_ARQLEN_ARQLEN_M; - q_info[1].reg.len_ena_mask = VF_ARQLEN_ARQENABLE_M; - q_info[1].reg.head_mask= VF_ARQH_ARQH_M; - } - - status = idpf_ctlq_init(hw, 2, q_info); - if (status) { - /* TODO return error */ - idpf_free(hw, q_info); - return
[PATCH v5 20/21] drivers: adding type to idpf vc queue switch
Adding an argument named type to define queue type in idpf_vc_queue_switch(). This solves the issue of improper queue type in virtchnl2 message. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/idpf_common_virtchnl.c | 8 ++-- drivers/common/idpf/idpf_common_virtchnl.h | 2 +- drivers/net/cpfl/cpfl_ethdev.c | 12 drivers/net/cpfl/cpfl_rxtx.c | 12 drivers/net/idpf/idpf_rxtx.c | 12 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c index f00202f43c..de511da788 100644 --- a/drivers/common/idpf/idpf_common_virtchnl.c +++ b/drivers/common/idpf/idpf_common_virtchnl.c @@ -769,15 +769,11 @@ idpf_vc_ena_dis_one_queue(struct idpf_vport *vport, uint16_t qid, int idpf_vc_queue_switch(struct idpf_vport *vport, uint16_t qid, -bool rx, bool on) +bool rx, bool on, uint32_t type) { - uint32_t type; int err, queue_id; - /* switch txq/rxq */ - type = rx ? VIRTCHNL2_QUEUE_TYPE_RX : VIRTCHNL2_QUEUE_TYPE_TX; - - if (type == VIRTCHNL2_QUEUE_TYPE_RX) + if (rx) queue_id = vport->chunks_info.rx_start_qid + qid; else queue_id = vport->chunks_info.tx_start_qid + qid; diff --git a/drivers/common/idpf/idpf_common_virtchnl.h b/drivers/common/idpf/idpf_common_virtchnl.h index 73446ded86..d6555978d5 100644 --- a/drivers/common/idpf/idpf_common_virtchnl.h +++ b/drivers/common/idpf/idpf_common_virtchnl.h @@ -31,7 +31,7 @@ int idpf_vc_cmd_execute(struct idpf_adapter *adapter, struct idpf_cmd_info *args); __rte_internal int idpf_vc_queue_switch(struct idpf_vport *vport, uint16_t qid, -bool rx, bool on); +bool rx, bool on, uint32_t type); __rte_internal int idpf_vc_queues_ena_dis(struct idpf_vport *vport, bool enable); __rte_internal diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index e707043bf7..9e2a74371e 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -1907,7 +1907,8 @@ cpfl_stop_cfgqs(struct cpfl_adapter_ext *adapter) int i, ret; for (i = 0; i < CPFL_TX_CFGQ_NUM; i++) { - ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, false, false); + ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, false, false, + VIRTCHNL2_QUEUE_TYPE_CONFIG_TX); if (ret) { PMD_DRV_LOG(ERR, "Fail to disable Tx config queue."); return ret; @@ -1915,7 +1916,8 @@ cpfl_stop_cfgqs(struct cpfl_adapter_ext *adapter) } for (i = 0; i < CPFL_RX_CFGQ_NUM; i++) { - ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, true, false); + ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, true, false, + VIRTCHNL2_QUEUE_TYPE_CONFIG_RX); if (ret) { PMD_DRV_LOG(ERR, "Fail to disable Rx config queue."); return ret; @@ -1943,7 +1945,8 @@ cpfl_start_cfgqs(struct cpfl_adapter_ext *adapter) } for (i = 0; i < CPFL_TX_CFGQ_NUM; i++) { - ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, false, true); + ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, false, true, + VIRTCHNL2_QUEUE_TYPE_CONFIG_TX); if (ret) { PMD_DRV_LOG(ERR, "Fail to enable Tx config queue."); return ret; @@ -1951,7 +1954,8 @@ cpfl_start_cfgqs(struct cpfl_adapter_ext *adapter) } for (i = 0; i < CPFL_RX_CFGQ_NUM; i++) { - ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, true, true); + ret = idpf_vc_queue_switch(&adapter->ctrl_vport.base, i, true, true, + VIRTCHNL2_QUEUE_TYPE_CONFIG_RX); if (ret) { PMD_DRV_LOG(ERR, "Fail to enable Rx config queue."); return ret; diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c index ab8bec4645..47351ca102 100644 --- a/drivers/net/cpfl/cpfl_rxtx.c +++ b/drivers/net/cpfl/cpfl_rxtx.c @@ -1200,7 +1200,8 @@ cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) } /* Ready to switch the queue on */ - err = idpf_vc_queue_switch(vport, rx_queue_id, true, true); + err = idpf_vc_queue_switch(vport, rx_queue_id, true, true, + VIRTCHNL2_QUEUE_TYPE_RX); if (err != 0) { PMD_D
[PATCH v5 21/21] doc: updated the documentation for cpfl PMD
Updated the latest support for cpfl pmd in MEV TS firmware version which is 1.4. Signed-off-by: Soumyadeep Hore --- doc/guides/nics/cpfl.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/guides/nics/cpfl.rst b/doc/guides/nics/cpfl.rst index 9b7a99c894..528c809819 100644 --- a/doc/guides/nics/cpfl.rst +++ b/doc/guides/nics/cpfl.rst @@ -35,6 +35,8 @@ Here is the suggested matching list which has been tested and verified. ++--+ |23.11 | 1.0| ++--+ + |24.07 | 1.4| + ++--+ Configuration -- 2.43.0
Re: [PATCH v4 13/13] eal: provide option to use compiler memcpy instead of RTE
20/06/2024 19:57, Mattias Rönnblom: > Provide build option to have functions in delegate to > the standard compiler/libc memcpy(), instead of using the various > custom DPDK, handcrafted, per-architecture rte_memcpy() > implementations. > > A new meson build option 'use_cc_memcpy' is added. By default, > the compiler/libc memcpy() is used. > > The performance benefits of the custom DPDK rte_memcpy() > implementations have been diminishing with every compiler release, and > with current toolchains the use of a custom memcpy() implementation > may even be a liability. > > This patch leaves an option to stay on the custom DPDK implementations, > would that prove beneficial for certain applications or architectures. [...] > --- a/meson_options.txt > +++ b/meson_options.txt > +option('use_cc_memcpy', type: 'boolean', value: true, description: > + 'Have the functions of delegate to compiler/libc > memcpy() instead of using custom implementation.') I suppose you propose this change for 24.11? I would prefer getting the option disabled in 24.07, so we can run tests during months before enabling it by default. This period would also help to make sure it is compiling in all cases. Please could you enable the option in our compilation scripts?
[PATCH] bus/vmbus: add device_order field to rte_vmbus_dev
Field can be used to have static interface naming in DPDK based applications instead of uuid. RTE_FOREACH_DEV won't return the correct order of such devices due to vmbus_ignore_device in case of blocklisting/allowlisting. So device_order field will be helpfull in that case. Signed-off-by: Vladimir Ratnikov --- drivers/bus/vmbus/bus_vmbus_driver.h | 1 + drivers/bus/vmbus/vmbus_common.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h index e2475a642d..6b010cbe41 100644 --- a/drivers/bus/vmbus/bus_vmbus_driver.h +++ b/drivers/bus/vmbus/bus_vmbus_driver.h @@ -37,6 +37,7 @@ struct rte_vmbus_device { rte_uuid_t device_id; /**< VMBUS device id */ rte_uuid_t class_id; /**< VMBUS device type */ uint32_t relid;/**< id for primary */ + uint16_t device_order; /**< Device order after probing */ uint8_t monitor_id;/**< monitor page */ int uio_num; /**< UIO device number */ uint32_t *int_page;/**< VMBUS interrupt page */ diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c index b9139c6e6c..1a64ab2712 100644 --- a/drivers/bus/vmbus/vmbus_common.c +++ b/drivers/bus/vmbus/vmbus_common.c @@ -199,7 +199,7 @@ rte_vmbus_probe(void) char ubuf[RTE_UUID_STRLEN]; FOREACH_DEVICE_ON_VMBUS(dev) { - probed++; + dev->device_order = probed++; rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf)); -- 2.34.1
[PATCH v2] bus/vmbus: add device_order field to rte_vmbus_dev
Field can be used to have static interface naming in DPDK based applications instead of uuid. RTE_FOREACH_DEV won't return the correct order of such devices due to vmbus_ignore_device in case of blocklisting/allowlisting. So device_order field will be helpful in that case. Signed-off-by: Vladimir Ratnikov --- drivers/bus/vmbus/bus_vmbus_driver.h | 1 + drivers/bus/vmbus/vmbus_common.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h index e2475a642d..6b010cbe41 100644 --- a/drivers/bus/vmbus/bus_vmbus_driver.h +++ b/drivers/bus/vmbus/bus_vmbus_driver.h @@ -37,6 +37,7 @@ struct rte_vmbus_device { rte_uuid_t device_id; /**< VMBUS device id */ rte_uuid_t class_id; /**< VMBUS device type */ uint32_t relid;/**< id for primary */ + uint16_t device_order; /**< Device order after probing */ uint8_t monitor_id;/**< monitor page */ int uio_num; /**< UIO device number */ uint32_t *int_page;/**< VMBUS interrupt page */ diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c index b9139c6e6c..1a64ab2712 100644 --- a/drivers/bus/vmbus/vmbus_common.c +++ b/drivers/bus/vmbus/vmbus_common.c @@ -199,7 +199,7 @@ rte_vmbus_probe(void) char ubuf[RTE_UUID_STRLEN]; FOREACH_DEVICE_ON_VMBUS(dev) { - probed++; + dev->device_order = probed++; rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf)); -- 2.34.1
[PATCH v2] bus/vmbus: add device_order field to rte_vmbus_dev
Field can be used to have static interface naming in DPDK based applications instead of uuid. RTE_FOREACH_DEV won't return the correct order of such devices due to vmbus_ignore_device in case of blocklisting/allowlisting. So device_order field will be helpful in that case. Signed-off-by: Vladimir Ratnikov --- drivers/bus/vmbus/bus_vmbus_driver.h | 1 + drivers/bus/vmbus/vmbus_common.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/vmbus/bus_vmbus_driver.h b/drivers/bus/vmbus/bus_vmbus_driver.h index e2475a642d..6b010cbe41 100644 --- a/drivers/bus/vmbus/bus_vmbus_driver.h +++ b/drivers/bus/vmbus/bus_vmbus_driver.h @@ -37,6 +37,7 @@ struct rte_vmbus_device { rte_uuid_t device_id; /**< VMBUS device id */ rte_uuid_t class_id; /**< VMBUS device type */ uint32_t relid;/**< id for primary */ + uint16_t device_order; /**< Device order after probing */ uint8_t monitor_id;/**< monitor page */ int uio_num; /**< UIO device number */ uint32_t *int_page;/**< VMBUS interrupt page */ diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c index b9139c6e6c..1a64ab2712 100644 --- a/drivers/bus/vmbus/vmbus_common.c +++ b/drivers/bus/vmbus/vmbus_common.c @@ -199,7 +199,7 @@ rte_vmbus_probe(void) char ubuf[RTE_UUID_STRLEN]; FOREACH_DEVICE_ON_VMBUS(dev) { - probed++; + dev->device_order = probed++; rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf)); -- 2.34.1
[PATCH v2 1/5] net/cnxk: fix stale offload flag reset
From: Amit Prakash Shukla mbuf buffer is not reset on tx and hence few fields has stale data from previous packets. Due to stale offload flags, in one of the scenarios with OVS, VxLAN offload flag was set while packet did not have the VxLAN header. In the OVS packet path, the flag was read and accordingly VxLAN processing was done but as packet did not have VxLAN header it caused segfault. This patch resets mbuf offload flags in rx burst function. Fixes: 46ebc0323151 ("net/cnxk: add eswitch Rx/Tx") Signed-off-by: Amit Prakash Shukla --- V2: * Added fixes tag drivers/net/cnxk/cnxk_eswitch_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c b/drivers/net/cnxk/cnxk_eswitch_rxtx.c index d57e32b091..0200392f2d 100644 --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c @@ -194,7 +194,7 @@ cnxk_eswitch_dev_rx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, mbuf->vlan_tci = rx->vtag0_tci; /* Populate RSS hash */ mbuf->hash.rss = cqe->tag; - mbuf->ol_flags |= RTE_MBUF_F_RX_RSS_HASH; + mbuf->ol_flags = RTE_MBUF_F_RX_RSS_HASH; pkts[pkt] = mbuf; roc_prefetch_store_keep(mbuf); plt_esw_dbg("Packet %d rec on queue %d esw qid %d hash %x mbuf %p vlan tci %d", -- 2.18.0
[PATCH v2 2/5] net/cnxk: add MTU set ops
From: Ankur Dwivedi Adding support for changing MTU of a representor port. This is required to allow processing jumbo packets. Using this operation, MTU of representor port is only changed, no MTU change shall be propagated to the respective represented port. Signed-off-by: Ankur Dwivedi --- V2: * Better commit message * Added to release notes doc/guides/rel_notes/release_24_07.rst | 2 ++ drivers/net/cnxk/cnxk_rep.h| 1 + drivers/net/cnxk/cnxk_rep_ops.c| 34 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index 7c88de381b..72ee6a812c 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -92,6 +92,8 @@ New Features * Added support disabling custom meta aura and separately use custom SA action support. + * Added MTU update for port representors. + * **Updated NVIDIA mlx5 driver.** * Added match with Tx queue. diff --git a/drivers/net/cnxk/cnxk_rep.h b/drivers/net/cnxk/cnxk_rep.h index 9bdea47bd4..ad89649702 100644 --- a/drivers/net/cnxk/cnxk_rep.h +++ b/drivers/net/cnxk/cnxk_rep.h @@ -146,5 +146,6 @@ int cnxk_rep_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, unsigned int n); int cnxk_rep_xstats_get_names_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, struct rte_eth_xstat_name *xstats_names, unsigned int n); +int cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu); #endif /* __CNXK_REP_H__ */ diff --git a/drivers/net/cnxk/cnxk_rep_ops.c b/drivers/net/cnxk/cnxk_rep_ops.c index 8bcb689468..42fa90 100644 --- a/drivers/net/cnxk/cnxk_rep_ops.c +++ b/drivers/net/cnxk/cnxk_rep_ops.c @@ -821,6 +821,37 @@ cnxk_rep_xstats_get_names_by_id(__rte_unused struct rte_eth_dev *eth_dev, const return n; } +int +cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) +{ + struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(eth_dev); + uint32_t frame_size = mtu + CNXK_NIX_L2_OVERHEAD; + int rc = -EINVAL; + + /* Check if MTU is within the allowed range */ + if ((frame_size - RTE_ETHER_CRC_LEN) < NIX_MIN_HW_FRS) { + plt_err("MTU is lesser than minimum"); + goto exit; + } + + if ((frame_size - RTE_ETHER_CRC_LEN) > + ((uint32_t)roc_nix_max_pkt_len(&rep_dev->parent_dev->nix))) { + plt_err("MTU is greater than maximum"); + goto exit; + } + + frame_size -= RTE_ETHER_CRC_LEN; + + /* Set frame size on Rx */ + rc = roc_nix_mac_max_rx_len_set(&rep_dev->parent_dev->nix, frame_size); + if (rc) { + plt_err("Failed to max Rx frame length, rc=%d", rc); + goto exit; + } +exit: + return rc; +} + /* CNXK platform representor dev ops */ struct eth_dev_ops cnxk_rep_dev_ops = { .dev_infos_get = cnxk_rep_dev_info_get, @@ -844,5 +875,6 @@ struct eth_dev_ops cnxk_rep_dev_ops = { .xstats_reset = cnxk_rep_xstats_reset, .xstats_get_names = cnxk_rep_xstats_get_names, .xstats_get_by_id = cnxk_rep_xstats_get_by_id, - .xstats_get_names_by_id = cnxk_rep_xstats_get_names_by_id + .xstats_get_names_by_id = cnxk_rep_xstats_get_names_by_id, + .mtu_set = cnxk_rep_mtu_set }; -- 2.18.0
[PATCH v2 3/5] net/cnxk: add multi seg support in eswitch
From: Ankur Dwivedi Introducing multi segment support in eswitch driver to handle packets of varying sizes which cannot be accommodated to a mbuf. Instead, the packet data is split across numerous mbufs, each carrying a portion, or 'segment', of the packet data. Signed-off-by: Ankur Dwivedi Signed-off-by: Harman Kalra --- V2: * Fixed clang-static compilation issue * Added to release notes * Better commit message doc/guides/rel_notes/release_24_07.rst | 2 + drivers/net/cnxk/cnxk_eswitch.c| 2 +- drivers/net/cnxk/cnxk_eswitch_rxtx.c | 164 ++--- 3 files changed, 148 insertions(+), 20 deletions(-) diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index 72ee6a812c..16c4222e68 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -94,6 +94,8 @@ New Features * Added MTU update for port representors. + * Added multi segment support to eswitch device. + * **Updated NVIDIA mlx5 driver.** * Added match with Tx queue. diff --git a/drivers/net/cnxk/cnxk_eswitch.c b/drivers/net/cnxk/cnxk_eswitch.c index f420d01ef8..6b1bfdd476 100644 --- a/drivers/net/cnxk/cnxk_eswitch.c +++ b/drivers/net/cnxk/cnxk_eswitch.c @@ -455,7 +455,7 @@ cnxk_eswitch_txq_setup(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, uint1 memset(sq, 0, sizeof(struct roc_nix_sq)); sq->qid = qid; sq->nb_desc = nb_desc; - sq->max_sqe_sz = NIX_MAXSQESZ_W8; + sq->max_sqe_sz = NIX_MAXSQESZ_W16; if (sq->nb_desc >= CNXK_NIX_DEF_SQ_COUNT) sq->fc_hyst_bits = 0x1; diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c b/drivers/net/cnxk/cnxk_eswitch_rxtx.c index 0200392f2d..6df4ecd762 100644 --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c @@ -39,31 +39,102 @@ eswitch_nix_rx_nb_pkts(struct roc_nix_cq *cq, const uint64_t wdata, const uint32 } static inline void -nix_cn9k_xmit_one(uint64_t *cmd, void *lmt_addr, const plt_iova_t io_addr) +nix_cn9k_xmit_one(uint64_t *cmd, void *lmt_addr, const plt_iova_t io_addr, uint16_t segdw) { uint64_t lmt_status; do { - roc_lmt_mov(lmt_addr, cmd, 0); + roc_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw); lmt_status = roc_lmt_submit_ldeor(io_addr); } while (lmt_status == 0); } +static __rte_always_inline uint16_t +cnxk_eswitch_prepare_mseg(struct rte_mbuf *m, union nix_send_sg_s *sg, uint64_t *cmd, uint8_t off) +{ + union nix_send_sg_s l_sg; + struct rte_mbuf *m_next; + uint64_t nb_segs; + uint64_t *slist; + uint16_t segdw; + uint64_t dlen; + + l_sg.u = 0; + l_sg.ld_type = NIX_SENDLDTYPE_LDD; + l_sg.subdc = NIX_SUBDC_SG; + + dlen = m->data_len; + l_sg.u |= dlen; + nb_segs = m->nb_segs - 1; + m_next = m->next; + m->next = NULL; + slist = &cmd[off + 1]; + l_sg.segs = 1; + *slist = rte_mbuf_data_iova(m); + slist++; + m = m_next; + if (!m) + goto done; + + do { + uint64_t iova; + + m_next = m->next; + iova = rte_mbuf_data_iova(m); + dlen = m->data_len; + + nb_segs--; + m->next = NULL; + + *slist = iova; + /* Set the segment length */ + l_sg.u |= ((uint64_t)dlen << (l_sg.segs << 4)); + l_sg.segs += 1; + slist++; + if (l_sg.segs > 2 && nb_segs) { + sg->u = l_sg.u; + /* Next SG subdesc */ + sg = (union nix_send_sg_s *)slist; + l_sg.u = 0; + l_sg.ld_type = NIX_SENDLDTYPE_LDD; + l_sg.subdc = NIX_SUBDC_SG; + slist++; + } + m = m_next; + } while (nb_segs); +done: + /* Write the last subdc out */ + sg->u = l_sg.u; + segdw = (uint64_t *)slist - (uint64_t *)&cmd[off]; + /* Roundup extra dwords to multiple of 2 */ + segdw = (segdw >> 1) + (segdw & 0x1); + /* Default dwords */ + segdw += (off >> 1); + + return segdw; +} + uint16_t cnxk_eswitch_dev_tx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, struct rte_mbuf **pkts, uint16_t nb_xmit, const uint16_t flags) { struct roc_nix_sq *sq = &eswitch_dev->txq[qid].sqs; struct roc_nix_rq *rq = &eswitch_dev->rxq[qid].rqs; - uint64_t aura_handle, cmd[6], data = 0; uint16_t lmt_id, pkt = 0, nb_tx = 0; struct nix_send_ext_s *send_hdr_ext; struct nix_send_hdr_s *send_hdr; + uint64_t aura_handle, data = 0; uint16_t vlan_tci = qid; union nix_send_sg_s *sg; uintptr_t lmt_base, pa; int64_t fc_pkts, dw_m1; + uint64_t cmd_cn9k[16]
[PATCH v2 4/5] net/cnxk: fix invalid pattern count
From: Amit Prakash Shukla Increment nb_pattern count to include RTE_FLOW_ITEM_TYPE_END. Fixes: aebe8cf310cc ("net/cnxk: create flow on representor ports") Signed-off-by: Amit Prakash Shukla --- V2: * Added fixes tag drivers/net/cnxk/cnxk_rep_flow.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/cnxk/cnxk_rep_flow.c b/drivers/net/cnxk/cnxk_rep_flow.c index d26f5aa12c..f1cf81a90c 100644 --- a/drivers/net/cnxk/cnxk_rep_flow.c +++ b/drivers/net/cnxk/cnxk_rep_flow.c @@ -171,6 +171,9 @@ populate_vxlan_encap_action_conf(const struct rte_flow_action_vxlan_encap *vxlan for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) nb_patterns++; + /* +1 for RTE_FLOW_ITEM_TYPE_END */ + nb_patterns++; + len = sizeof(uint64_t); rte_memcpy(vxlan_encap_action_data, &nb_patterns, len); pattern = vxlan_conf->definition; -- 2.18.0
[PATCH v2 5/5] net/cnxk: fix representor port mapping
From: Hanumanth Pothula As part of ready and exit messages only first half of the ports were processed, i.e. represented to representor port mapping was setup and released. While later half of the ports were not processed. Fixes: 804c585658ea ("net/cnxk: add representor control plane") Signed-off-by: Hanumanth Pothula --- V2: * Added fixes tag * Better commit message drivers/net/cnxk/cnxk_rep_msg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c index f3a62a805e..29ce94e5c6 100644 --- a/drivers/net/cnxk/cnxk_rep_msg.c +++ b/drivers/net/cnxk/cnxk_rep_msg.c @@ -369,12 +369,12 @@ notify_rep_dev_ready(cnxk_rep_msg_ready_data_t *rdata, void *data, memset(rep_id_arr, 0, RTE_MAX_ETHPORTS * sizeof(uint64_t)); /* For ready state */ - if ((rdata->nb_ports / 2) > eswitch_dev->repr_cnt.nb_repr_probed) { + if (rdata->nb_ports > eswitch_dev->repr_cnt.nb_repr_probed) { rc = CNXK_REP_CTRL_MSG_NACK_INV_REP_CNT; goto fail; } - for (i = 0; i < rdata->nb_ports / 2; i++) { + for (i = 0; i < rdata->nb_ports; i++) { rep_id = UINT16_MAX; rc = cnxk_rep_state_update(eswitch_dev, rdata->data[i], &rep_id); if (rc) { @@ -475,7 +475,7 @@ notify_rep_dev_exit(cnxk_rep_msg_exit_data_t *edata, void *data) rc = -EINVAL; goto fail; } - if ((edata->nb_ports / 2) > eswitch_dev->repr_cnt.nb_repr_probed) { + if (edata->nb_ports > eswitch_dev->repr_cnt.nb_repr_probed) { rc = CNXK_REP_CTRL_MSG_NACK_INV_REP_CNT; goto fail; } -- 2.18.0
[PATCH v3 1/5] net/cnxk: fix stale offload flag reset
From: Amit Prakash Shukla mbuf buffer is not reset on tx and hence few fields has stale data from previous packets. Due to stale offload flags, in one of the scenarios with OVS, VxLAN offload flag was set while packet did not have the VxLAN header. In the OVS packet path, the flag was read and accordingly VxLAN processing was done but as packet did not have VxLAN header it caused segfault. This patch resets mbuf offload flags in rx burst function. Fixes: 46ebc0323151 ("net/cnxk: add eswitch Rx/Tx") Signed-off-by: Amit Prakash Shukla --- V2: * Added fixes tag drivers/net/cnxk/cnxk_eswitch_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c b/drivers/net/cnxk/cnxk_eswitch_rxtx.c index d57e32b091..0200392f2d 100644 --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c @@ -194,7 +194,7 @@ cnxk_eswitch_dev_rx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, mbuf->vlan_tci = rx->vtag0_tci; /* Populate RSS hash */ mbuf->hash.rss = cqe->tag; - mbuf->ol_flags |= RTE_MBUF_F_RX_RSS_HASH; + mbuf->ol_flags = RTE_MBUF_F_RX_RSS_HASH; pkts[pkt] = mbuf; roc_prefetch_store_keep(mbuf); plt_esw_dbg("Packet %d rec on queue %d esw qid %d hash %x mbuf %p vlan tci %d", -- 2.18.0
[PATCH v3 2/5] net/cnxk: add MTU set ops
From: Ankur Dwivedi Adding support for changing MTU of a representor port. This is required to allow processing jumbo packets. Using this operation, MTU of representor port is only changed, no MTU change shall be propagated to the respective represented port. Signed-off-by: Ankur Dwivedi --- V2: * Better commit message * Added to release notes V3: * Minor correction in release notes doc/guides/rel_notes/release_24_07.rst | 2 ++ drivers/net/cnxk/cnxk_rep.h| 1 + drivers/net/cnxk/cnxk_rep_ops.c| 34 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index 7c88de381b..adf772f488 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -92,6 +92,8 @@ New Features * Added support disabling custom meta aura and separately use custom SA action support. + * Added MTU update for port representor. + * **Updated NVIDIA mlx5 driver.** * Added match with Tx queue. diff --git a/drivers/net/cnxk/cnxk_rep.h b/drivers/net/cnxk/cnxk_rep.h index 9bdea47bd4..ad89649702 100644 --- a/drivers/net/cnxk/cnxk_rep.h +++ b/drivers/net/cnxk/cnxk_rep.h @@ -146,5 +146,6 @@ int cnxk_rep_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, unsigned int n); int cnxk_rep_xstats_get_names_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, struct rte_eth_xstat_name *xstats_names, unsigned int n); +int cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu); #endif /* __CNXK_REP_H__ */ diff --git a/drivers/net/cnxk/cnxk_rep_ops.c b/drivers/net/cnxk/cnxk_rep_ops.c index 8bcb689468..42fa90 100644 --- a/drivers/net/cnxk/cnxk_rep_ops.c +++ b/drivers/net/cnxk/cnxk_rep_ops.c @@ -821,6 +821,37 @@ cnxk_rep_xstats_get_names_by_id(__rte_unused struct rte_eth_dev *eth_dev, const return n; } +int +cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) +{ + struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(eth_dev); + uint32_t frame_size = mtu + CNXK_NIX_L2_OVERHEAD; + int rc = -EINVAL; + + /* Check if MTU is within the allowed range */ + if ((frame_size - RTE_ETHER_CRC_LEN) < NIX_MIN_HW_FRS) { + plt_err("MTU is lesser than minimum"); + goto exit; + } + + if ((frame_size - RTE_ETHER_CRC_LEN) > + ((uint32_t)roc_nix_max_pkt_len(&rep_dev->parent_dev->nix))) { + plt_err("MTU is greater than maximum"); + goto exit; + } + + frame_size -= RTE_ETHER_CRC_LEN; + + /* Set frame size on Rx */ + rc = roc_nix_mac_max_rx_len_set(&rep_dev->parent_dev->nix, frame_size); + if (rc) { + plt_err("Failed to max Rx frame length, rc=%d", rc); + goto exit; + } +exit: + return rc; +} + /* CNXK platform representor dev ops */ struct eth_dev_ops cnxk_rep_dev_ops = { .dev_infos_get = cnxk_rep_dev_info_get, @@ -844,5 +875,6 @@ struct eth_dev_ops cnxk_rep_dev_ops = { .xstats_reset = cnxk_rep_xstats_reset, .xstats_get_names = cnxk_rep_xstats_get_names, .xstats_get_by_id = cnxk_rep_xstats_get_by_id, - .xstats_get_names_by_id = cnxk_rep_xstats_get_names_by_id + .xstats_get_names_by_id = cnxk_rep_xstats_get_names_by_id, + .mtu_set = cnxk_rep_mtu_set }; -- 2.18.0
[PATCH v3 3/5] net/cnxk: add multi seg support in eswitch
From: Ankur Dwivedi Introducing multi segment support in eswitch driver to handle packets of varying sizes which cannot be accommodated to a mbuf. Instead, the packet data is split across numerous mbufs, each carrying a portion, or 'segment', of the packet data. Signed-off-by: Ankur Dwivedi Signed-off-by: Harman Kalra --- V2: * Fixed clang-static compilation issue * Added to release notes * Better commit message V3: * Minor correction in release notes doc/guides/rel_notes/release_24_07.rst | 2 + drivers/net/cnxk/cnxk_eswitch.c| 2 +- drivers/net/cnxk/cnxk_eswitch_rxtx.c | 164 ++--- 3 files changed, 148 insertions(+), 20 deletions(-) diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst index adf772f488..48c6d8fa64 100644 --- a/doc/guides/rel_notes/release_24_07.rst +++ b/doc/guides/rel_notes/release_24_07.rst @@ -94,6 +94,8 @@ New Features * Added MTU update for port representor. + * Added multi segment support for port representor. + * **Updated NVIDIA mlx5 driver.** * Added match with Tx queue. diff --git a/drivers/net/cnxk/cnxk_eswitch.c b/drivers/net/cnxk/cnxk_eswitch.c index f420d01ef8..6b1bfdd476 100644 --- a/drivers/net/cnxk/cnxk_eswitch.c +++ b/drivers/net/cnxk/cnxk_eswitch.c @@ -455,7 +455,7 @@ cnxk_eswitch_txq_setup(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, uint1 memset(sq, 0, sizeof(struct roc_nix_sq)); sq->qid = qid; sq->nb_desc = nb_desc; - sq->max_sqe_sz = NIX_MAXSQESZ_W8; + sq->max_sqe_sz = NIX_MAXSQESZ_W16; if (sq->nb_desc >= CNXK_NIX_DEF_SQ_COUNT) sq->fc_hyst_bits = 0x1; diff --git a/drivers/net/cnxk/cnxk_eswitch_rxtx.c b/drivers/net/cnxk/cnxk_eswitch_rxtx.c index 0200392f2d..6df4ecd762 100644 --- a/drivers/net/cnxk/cnxk_eswitch_rxtx.c +++ b/drivers/net/cnxk/cnxk_eswitch_rxtx.c @@ -39,31 +39,102 @@ eswitch_nix_rx_nb_pkts(struct roc_nix_cq *cq, const uint64_t wdata, const uint32 } static inline void -nix_cn9k_xmit_one(uint64_t *cmd, void *lmt_addr, const plt_iova_t io_addr) +nix_cn9k_xmit_one(uint64_t *cmd, void *lmt_addr, const plt_iova_t io_addr, uint16_t segdw) { uint64_t lmt_status; do { - roc_lmt_mov(lmt_addr, cmd, 0); + roc_lmt_mov_seg(lmt_addr, (const void *)cmd, segdw); lmt_status = roc_lmt_submit_ldeor(io_addr); } while (lmt_status == 0); } +static __rte_always_inline uint16_t +cnxk_eswitch_prepare_mseg(struct rte_mbuf *m, union nix_send_sg_s *sg, uint64_t *cmd, uint8_t off) +{ + union nix_send_sg_s l_sg; + struct rte_mbuf *m_next; + uint64_t nb_segs; + uint64_t *slist; + uint16_t segdw; + uint64_t dlen; + + l_sg.u = 0; + l_sg.ld_type = NIX_SENDLDTYPE_LDD; + l_sg.subdc = NIX_SUBDC_SG; + + dlen = m->data_len; + l_sg.u |= dlen; + nb_segs = m->nb_segs - 1; + m_next = m->next; + m->next = NULL; + slist = &cmd[off + 1]; + l_sg.segs = 1; + *slist = rte_mbuf_data_iova(m); + slist++; + m = m_next; + if (!m) + goto done; + + do { + uint64_t iova; + + m_next = m->next; + iova = rte_mbuf_data_iova(m); + dlen = m->data_len; + + nb_segs--; + m->next = NULL; + + *slist = iova; + /* Set the segment length */ + l_sg.u |= ((uint64_t)dlen << (l_sg.segs << 4)); + l_sg.segs += 1; + slist++; + if (l_sg.segs > 2 && nb_segs) { + sg->u = l_sg.u; + /* Next SG subdesc */ + sg = (union nix_send_sg_s *)slist; + l_sg.u = 0; + l_sg.ld_type = NIX_SENDLDTYPE_LDD; + l_sg.subdc = NIX_SUBDC_SG; + slist++; + } + m = m_next; + } while (nb_segs); +done: + /* Write the last subdc out */ + sg->u = l_sg.u; + segdw = (uint64_t *)slist - (uint64_t *)&cmd[off]; + /* Roundup extra dwords to multiple of 2 */ + segdw = (segdw >> 1) + (segdw & 0x1); + /* Default dwords */ + segdw += (off >> 1); + + return segdw; +} + uint16_t cnxk_eswitch_dev_tx_burst(struct cnxk_eswitch_dev *eswitch_dev, uint16_t qid, struct rte_mbuf **pkts, uint16_t nb_xmit, const uint16_t flags) { struct roc_nix_sq *sq = &eswitch_dev->txq[qid].sqs; struct roc_nix_rq *rq = &eswitch_dev->rxq[qid].rqs; - uint64_t aura_handle, cmd[6], data = 0; uint16_t lmt_id, pkt = 0, nb_tx = 0; struct nix_send_ext_s *send_hdr_ext; struct nix_send_hdr_s *send_hdr; + uint64_t aura_handle, data = 0; uint16_t vlan_tci = qid; union nix_send_sg_s *sg; uintptr_t lmt_base, pa; int64_t f
[PATCH v3 4/5] net/cnxk: fix invalid pattern count
From: Amit Prakash Shukla Increment nb_pattern count to include RTE_FLOW_ITEM_TYPE_END. Fixes: aebe8cf310cc ("net/cnxk: create flow on representor ports") Signed-off-by: Amit Prakash Shukla --- V2: * Added fixes tag drivers/net/cnxk/cnxk_rep_flow.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/cnxk/cnxk_rep_flow.c b/drivers/net/cnxk/cnxk_rep_flow.c index d26f5aa12c..f1cf81a90c 100644 --- a/drivers/net/cnxk/cnxk_rep_flow.c +++ b/drivers/net/cnxk/cnxk_rep_flow.c @@ -171,6 +171,9 @@ populate_vxlan_encap_action_conf(const struct rte_flow_action_vxlan_encap *vxlan for (; pattern->type != RTE_FLOW_ITEM_TYPE_END; pattern++) nb_patterns++; + /* +1 for RTE_FLOW_ITEM_TYPE_END */ + nb_patterns++; + len = sizeof(uint64_t); rte_memcpy(vxlan_encap_action_data, &nb_patterns, len); pattern = vxlan_conf->definition; -- 2.18.0
[PATCH v3 5/5] net/cnxk: fix representor port mapping
From: Hanumanth Pothula As part of ready and exit messages only first half of the ports were processed, i.e. represented to representor port mapping was setup and released. While later half of the ports were not processed. Fixes: 804c585658ea ("net/cnxk: add representor control plane") Signed-off-by: Hanumanth Pothula --- V2: * Added fixes tag * Better commit message drivers/net/cnxk/cnxk_rep_msg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c index f3a62a805e..29ce94e5c6 100644 --- a/drivers/net/cnxk/cnxk_rep_msg.c +++ b/drivers/net/cnxk/cnxk_rep_msg.c @@ -369,12 +369,12 @@ notify_rep_dev_ready(cnxk_rep_msg_ready_data_t *rdata, void *data, memset(rep_id_arr, 0, RTE_MAX_ETHPORTS * sizeof(uint64_t)); /* For ready state */ - if ((rdata->nb_ports / 2) > eswitch_dev->repr_cnt.nb_repr_probed) { + if (rdata->nb_ports > eswitch_dev->repr_cnt.nb_repr_probed) { rc = CNXK_REP_CTRL_MSG_NACK_INV_REP_CNT; goto fail; } - for (i = 0; i < rdata->nb_ports / 2; i++) { + for (i = 0; i < rdata->nb_ports; i++) { rep_id = UINT16_MAX; rc = cnxk_rep_state_update(eswitch_dev, rdata->data[i], &rep_id); if (rc) { @@ -475,7 +475,7 @@ notify_rep_dev_exit(cnxk_rep_msg_exit_data_t *edata, void *data) rc = -EINVAL; goto fail; } - if ((edata->nb_ports / 2) > eswitch_dev->repr_cnt.nb_repr_probed) { + if (edata->nb_ports > eswitch_dev->repr_cnt.nb_repr_probed) { rc = CNXK_REP_CTRL_MSG_NACK_INV_REP_CNT; goto fail; } -- 2.18.0
[PATCH v5 0/4] dts: API docs generation
The generation is done with Sphinx, which DPDK already uses, with slightly modified configuration of the sidebar present in an if block. Dependencies are installed using Poetry from the dts directory: poetry install --with docs After installing, enter the Poetry shell: poetry shell And then run the build: ninja -C dts-doc Python3.10 is required to build the DTS API docs. The patchset contains the .rst sources which Sphinx uses to generate the html pages. These were first generated with the sphinx-apidoc utility and modified to provide a better look. The documentation just doesn't look that good without the modifications and there isn't enough configuration options to achieve that without manual changes to the .rst files. This introduces extra maintenance which involves adding new .rst files when a new Python module is added or changing the .rst structure if the Python directory/file structure is changed (moved, renamed files). This small maintenance burden is outweighed by the flexibility afforded by the ability to make manual changes to the .rst files. v2: Removed the use of sphinx-apidoc from meson in favor of adding the files generated by it directly to the repository (and modifying them). v3: Rebase. v4: Rebase. v5: Another rebase, but this time the rebase needed the addition of .rst corresponding to newly added files as well as fixing a few documentation problems in said files. Juraj Linkeš (4): dts: update params and parser docstrings dts: add doc generation dependencies dts: add API doc sources dts: add API doc generation buildtools/call-sphinx-build.py | 31 +- doc/api/doxy-api-index.md | 3 + doc/api/doxy-api.conf.in | 2 + doc/api/meson.build | 11 +- doc/guides/conf.py| 39 +- doc/guides/meson.build| 1 + doc/guides/tools/dts.rst | 34 +- dts/doc/conf_yaml_schema.json | 1 + dts/doc/framework.config.rst | 12 + dts/doc/framework.config.types.rst| 6 + dts/doc/framework.exception.rst | 6 + dts/doc/framework.logger.rst | 6 + dts/doc/framework.params.eal.rst | 6 + dts/doc/framework.params.rst | 14 + dts/doc/framework.params.testpmd.rst | 6 + dts/doc/framework.params.types.rst| 6 + dts/doc/framework.parser.rst | 6 + .../framework.remote_session.dpdk_shell.rst | 6 + ...ote_session.interactive_remote_session.rst | 6 + ...ework.remote_session.interactive_shell.rst | 6 + .../framework.remote_session.python_shell.rst | 6 + ...ramework.remote_session.remote_session.rst | 6 + dts/doc/framework.remote_session.rst | 18 + .../framework.remote_session.ssh_session.rst | 6 + ...framework.remote_session.testpmd_shell.rst | 6 + dts/doc/framework.runner.rst | 6 + dts/doc/framework.settings.rst| 6 + dts/doc/framework.test_result.rst | 6 + dts/doc/framework.test_suite.rst | 6 + dts/doc/framework.testbed_model.cpu.rst | 6 + .../framework.testbed_model.linux_session.rst | 6 + dts/doc/framework.testbed_model.node.rst | 6 + .../framework.testbed_model.os_session.rst| 6 + dts/doc/framework.testbed_model.port.rst | 6 + .../framework.testbed_model.posix_session.rst | 6 + dts/doc/framework.testbed_model.rst | 26 + dts/doc/framework.testbed_model.sut_node.rst | 6 + dts/doc/framework.testbed_model.tg_node.rst | 6 + ..._generator.capturing_traffic_generator.rst | 6 + ...mework.testbed_model.traffic_generator.rst | 14 + testbed_model.traffic_generator.scapy.rst | 6 + ...el.traffic_generator.traffic_generator.rst | 6 + ...framework.testbed_model.virtual_device.rst | 6 + dts/doc/framework.utils.rst | 6 + dts/doc/index.rst | 43 ++ dts/doc/meson.build | 27 + dts/framework/params/__init__.py | 4 +- dts/framework/params/eal.py | 7 +- dts/framework/params/types.py | 3 +- dts/framework/parser.py | 4 +- dts/meson.build | 16 + dts/poetry.lock | 510 +- dts/pyproject.toml| 7 + meson.build | 1 + 54 files changed, 977 insertions(+), 37 deletions(-) create mode 12 dts/doc/conf_yaml_schema.json create mode 100644 dts/doc/framework.config.rst create mode 100644 dts/doc/framework.config.types.rst create mode 100644 dts/doc/framework.exception.rst create mode 100644 dts/doc/framework.logger.rst create mode 100644 dts/doc/framework.params.eal.rst create mode 100644 dts/doc/framework.params.rst create mode 10
[PATCH v5 1/4] dts: update params and parser docstrings
Address a few errors reported by Sphinx when generating documentation: framework/params/__init__.py:docstring of framework.params.modify_str:3: WARNING: Inline interpreted text or phrase reference start-string without end-string. framework/params/eal.py:docstring of framework.params.eal.EalParams:35: WARNING: Definition list ends without a blank line; unexpected unindent. framework/params/types.py:docstring of framework.params.types:8: WARNING: Inline strong start-string without end-string. framework/params/types.py:docstring of framework.params.types:9: WARNING: Inline strong start-string without end-string. framework/parser.py:docstring of framework.parser.TextParser:33: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser:43: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser:49: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser.wrap:8: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser.wrap:9: WARNING: Block quote ends without a blank line; unexpected unindent. Fixes: 87ba4cdc0dbb ("dts: use Unpack for type checking and hinting") Fixes: d70159cb62f5 ("dts: add params manipulation module") Fixes: 967fc62b0a43 ("dts: refactor EAL parameters class") Fixes: 818fe14e3422 ("dts: add parsing utility module") Cc: luca.vizza...@arm.com Signed-off-by: Juraj Linkeš --- dts/framework/params/__init__.py | 4 ++-- dts/framework/params/eal.py | 7 +-- dts/framework/params/types.py| 3 ++- dts/framework/parser.py | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dts/framework/params/__init__.py b/dts/framework/params/__init__.py index 5a6fd93053..1ae227d7b4 100644 --- a/dts/framework/params/__init__.py +++ b/dts/framework/params/__init__.py @@ -53,9 +53,9 @@ def reduced_fn(value): def modify_str(*funcs: FnPtr) -> Callable[[T], T]: -"""Class decorator modifying the ``__str__`` method with a function created from its arguments. +r"""Class decorator modifying the ``__str__`` method with a function created from its arguments. -The :attr:`FnPtr`s fed to the decorator are executed from left to right in the arguments list +The :attr:`FnPtr`\s fed to the decorator are executed from left to right in the arguments list order. Args: diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py index 8d7766fefc..cf1594353a 100644 --- a/dts/framework/params/eal.py +++ b/dts/framework/params/eal.py @@ -26,13 +26,16 @@ class EalParams(Params): prefix: Set the file prefix string with which to start DPDK, e.g.: ``prefix="vf"``. no_pci: Switch to disable PCI bus, e.g.: ``no_pci=True``. vdevs: Virtual devices, e.g.:: + vdevs=[ VirtualDevice('net_ring0'), VirtualDevice('net_ring1') ] + ports: The list of ports to allow. -other_eal_param: user defined DPDK EAL parameters, e.g.: -``other_eal_param='--single-file-segments'`` +other_eal_param: user defined DPDK EAL parameters, e.g.:: + +``other_eal_param='--single-file-segments'`` """ lcore_list: LogicalCoreList | None = field(default=None, metadata=Params.short("l")) diff --git a/dts/framework/params/types.py b/dts/framework/params/types.py index e668f658d8..d77c4625fb 100644 --- a/dts/framework/params/types.py +++ b/dts/framework/params/types.py @@ -6,7 +6,8 @@ TypedDicts can be used in conjunction with Unpack and kwargs for type hinting on function calls. Example: -..code:: python +.. code:: python + def create_testpmd(**kwargs: Unpack[TestPmdParamsDict]): params = TestPmdParams(**kwargs) """ diff --git a/dts/framework/parser.py b/dts/framework/parser.py index 741dfff821..7254c75b71 100644 --- a/dts/framework/parser.py +++ b/dts/framework/parser.py @@ -46,7 +46,7 @@ class TextParser(ABC): Example: The following example makes use of and demonstrates every parser function available: -..code:: python +.. code:: python from dataclasses import dataclass, field from enum import Enum @@ -90,7 +90,7 @@ def wrap(parser_fn: ParserFn, wrapper_fn: Callable) -> ParserFn: """Makes a wrapped parser function. `parser_fn` is called and if a non-None value is returned, `wrapper_function` is called with -it. Otherwise the function returns early with None. In pseudo-code: +it. Otherwise the function returns early with None. In pseudo-code:: intermediate_value := parser_fn(input) if intermediary_value is None then -- 2.34.1
[PATCH v5 2/4] dts: add doc generation dependencies
Sphinx imports every Python module when generating documentation from docstrings, meaning all DTS dependencies, including Python version, must be satisfied. By adding Sphinx to DTS dependencies we provide a convenient way to generate the DTS API docs which satisfies all dependencies. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro --- dts/poetry.lock| 510 +++-- dts/pyproject.toml | 7 + 2 files changed, 505 insertions(+), 12 deletions(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index 5f8fa03933..b6e27f8f38 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -1,5 +1,16 @@ # This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +[[package]] +name = "alabaster" +version = "0.7.13" +description = "A configurable sidebar-enabled Sphinx theme" +optional = false +python-versions = ">=3.6" +files = [ +{file = "alabaster-0.7.13-py3-none-any.whl", hash = "sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3"}, +{file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, +] + [[package]] name = "attrs" version = "23.1.0" @@ -18,6 +29,23 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +[[package]] +name = "babel" +version = "2.13.1" +description = "Internationalization utilities" +optional = false +python-versions = ">=3.7" +files = [ +{file = "Babel-2.13.1-py3-none-any.whl", hash = "sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed"}, +{file = "Babel-2.13.1.tar.gz", hash = "sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900"}, +] + +[package.dependencies] +setuptools = {version = "*", markers = "python_version >= \"3.12\""} + +[package.extras] +dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] + [[package]] name = "bcrypt" version = "4.0.1" @@ -86,6 +114,17 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] +[[package]] +name = "certifi" +version = "2023.7.22" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +files = [ +{file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, +{file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, +] + [[package]] name = "cffi" version = "1.15.1" @@ -162,6 +201,105 @@ files = [ [package.dependencies] pycparser = "*" +[[package]] +name = "charset-normalizer" +version = "3.3.2" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7.0" +files = [ +{file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06
[PATCH v5 4/4] dts: add API doc generation
The tool used to generate DTS API docs is Sphinx, which is already in use in DPDK. The same configuration is used to preserve style with one DTS-specific configuration (so that the DPDK docs are unchanged) that modifies how the sidebar displays the content. Sphinx generates the documentation from Python docstrings. The docstring format is the Google format [0] which requires the sphinx.ext.napoleon extension. The other extension, sphinx.ext.intersphinx, enables linking to object in external documentations, such as the Python documentation. There are two requirements for building DTS docs: * The same Python version as DTS or higher, because Sphinx imports the code. * Also the same Python packages as DTS, for the same reason. [0] https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro Tested-by: Nicholas Pratte --- buildtools/call-sphinx-build.py | 31 ++ doc/api/doxy-api-index.md | 3 +++ doc/api/doxy-api.conf.in| 2 ++ doc/api/meson.build | 11 +++--- doc/guides/conf.py | 39 - doc/guides/meson.build | 1 + doc/guides/tools/dts.rst| 34 +++- dts/doc/meson.build | 27 +++ dts/meson.build | 16 ++ meson.build | 1 + 10 files changed, 147 insertions(+), 18 deletions(-) create mode 100644 dts/doc/meson.build create mode 100644 dts/meson.build diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py index da19e950c9..dff8471560 100755 --- a/buildtools/call-sphinx-build.py +++ b/buildtools/call-sphinx-build.py @@ -3,31 +3,44 @@ # Copyright(c) 2019 Intel Corporation # +import argparse import sys import os from os.path import join from subprocess import run -# assign parameters to variables -(sphinx, version, src, dst, *extra_args) = sys.argv[1:] +parser = argparse.ArgumentParser() +parser.add_argument('sphinx') +parser.add_argument('version') +parser.add_argument('src') +parser.add_argument('dst') +parser.add_argument('--dts-root', default=None) +args, extra_args = parser.parse_known_args() # set the version in environment for sphinx to pick up -os.environ['DPDK_VERSION'] = version +os.environ['DPDK_VERSION'] = args.version +if args.dts_root: +os.environ['DTS_ROOT'] = args.dts_root -sphinx_cmd = [sphinx] + extra_args +sphinx_cmd = [args.sphinx] + extra_args # find all the files sphinx will process so we can write them as dependencies srcfiles = [] -for root, dirs, files in os.walk(src): +for root, dirs, files in os.walk(args.src): srcfiles.extend([join(root, f) for f in files]) +if not os.path.exists(args.dst): +os.makedirs(args.dst) + # run sphinx, putting the html output in a "html" directory -with open(join(dst, 'sphinx_html.out'), 'w') as out: -process = run(sphinx_cmd + ['-b', 'html', src, join(dst, 'html')], - stdout=out) +with open(join(args.dst, 'sphinx_html.out'), 'w') as out: +process = run( +sphinx_cmd + ['-b', 'html', args.src, join(args.dst, 'html')], +stdout=out +) # create a gcc format .d file giving all the dependencies of this doc build -with open(join(dst, '.html.d'), 'w') as d: +with open(join(args.dst, '.html.d'), 'w') as d: d.write('html: ' + ' '.join(srcfiles) + '\n') sys.exit(process.returncode) diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index f9283154f8..cc214ede46 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -244,3 +244,6 @@ The public API headers are grouped by topics: [experimental APIs](@ref rte_compat.h), [ABI versioning](@ref rte_function_versioning.h), [version](@ref rte_version.h) + +- **tests**: + [**DTS**](@dts_api_main_page) diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index a8823c046f..c94f02d411 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -124,6 +124,8 @@ SEARCHENGINE= YES SORT_MEMBER_DOCS= NO SOURCE_BROWSER = YES +ALIASES = "dts_api_main_page=@DTS_API_MAIN_PAGE@" + EXAMPLE_PATH= @TOPDIR@/examples EXAMPLE_PATTERNS= *.c EXAMPLE_RECURSIVE = YES diff --git a/doc/api/meson.build b/doc/api/meson.build index 5b50692df9..ffc75d7b5a 100644 --- a/doc/api/meson.build +++ b/doc/api/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi +doc_api_build_dir = meson.current_build_dir() doxygen = find_program('doxygen', required: get_option('enable_docs')) if not doxygen.found() @@ -32,14 +33,18 @@ example = custom_target('examples.dox', # set up common Doxygen configuration cdata = configuration_data() cdata.set('VERSION', meson.project_version()) -cdata.set('API_EXAMPLES', joi
[PATCH v5 3/4] dts: add API doc sources
These sources could be generated with the sphinx-apidoc utility, but that doesn't give us enough flexibility, such as sorting the order of modules or changing the headers of the modules. The sources included in this patch were in fact generated by said utility, but modified to improve the look of the documentation. The improvements are mainly in toctree definitions and the titles of the modules/packages. These were made with specific Sphinx config options in mind. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro --- dts/doc/conf_yaml_schema.json | 1 + dts/doc/framework.config.rst | 12 ++ dts/doc/framework.config.types.rst| 6 +++ dts/doc/framework.exception.rst | 6 +++ dts/doc/framework.logger.rst | 6 +++ dts/doc/framework.params.eal.rst | 6 +++ dts/doc/framework.params.rst | 14 ++ dts/doc/framework.params.testpmd.rst | 6 +++ dts/doc/framework.params.types.rst| 6 +++ dts/doc/framework.parser.rst | 6 +++ .../framework.remote_session.dpdk_shell.rst | 6 +++ ...ote_session.interactive_remote_session.rst | 6 +++ ...ework.remote_session.interactive_shell.rst | 6 +++ .../framework.remote_session.python_shell.rst | 6 +++ ...ramework.remote_session.remote_session.rst | 6 +++ dts/doc/framework.remote_session.rst | 18 .../framework.remote_session.ssh_session.rst | 6 +++ ...framework.remote_session.testpmd_shell.rst | 6 +++ dts/doc/framework.runner.rst | 6 +++ dts/doc/framework.settings.rst| 6 +++ dts/doc/framework.test_result.rst | 6 +++ dts/doc/framework.test_suite.rst | 6 +++ dts/doc/framework.testbed_model.cpu.rst | 6 +++ .../framework.testbed_model.linux_session.rst | 6 +++ dts/doc/framework.testbed_model.node.rst | 6 +++ .../framework.testbed_model.os_session.rst| 6 +++ dts/doc/framework.testbed_model.port.rst | 6 +++ .../framework.testbed_model.posix_session.rst | 6 +++ dts/doc/framework.testbed_model.rst | 26 +++ dts/doc/framework.testbed_model.sut_node.rst | 6 +++ dts/doc/framework.testbed_model.tg_node.rst | 6 +++ ..._generator.capturing_traffic_generator.rst | 6 +++ ...mework.testbed_model.traffic_generator.rst | 14 ++ testbed_model.traffic_generator.scapy.rst | 6 +++ ...el.traffic_generator.traffic_generator.rst | 6 +++ ...framework.testbed_model.virtual_device.rst | 6 +++ dts/doc/framework.utils.rst | 6 +++ dts/doc/index.rst | 43 +++ 38 files changed, 314 insertions(+) create mode 12 dts/doc/conf_yaml_schema.json create mode 100644 dts/doc/framework.config.rst create mode 100644 dts/doc/framework.config.types.rst create mode 100644 dts/doc/framework.exception.rst create mode 100644 dts/doc/framework.logger.rst create mode 100644 dts/doc/framework.params.eal.rst create mode 100644 dts/doc/framework.params.rst create mode 100644 dts/doc/framework.params.testpmd.rst create mode 100644 dts/doc/framework.params.types.rst create mode 100644 dts/doc/framework.parser.rst create mode 100644 dts/doc/framework.remote_session.dpdk_shell.rst create mode 100644 dts/doc/framework.remote_session.interactive_remote_session.rst create mode 100644 dts/doc/framework.remote_session.interactive_shell.rst create mode 100644 dts/doc/framework.remote_session.python_shell.rst create mode 100644 dts/doc/framework.remote_session.remote_session.rst create mode 100644 dts/doc/framework.remote_session.rst create mode 100644 dts/doc/framework.remote_session.ssh_session.rst create mode 100644 dts/doc/framework.remote_session.testpmd_shell.rst create mode 100644 dts/doc/framework.runner.rst create mode 100644 dts/doc/framework.settings.rst create mode 100644 dts/doc/framework.test_result.rst create mode 100644 dts/doc/framework.test_suite.rst create mode 100644 dts/doc/framework.testbed_model.cpu.rst create mode 100644 dts/doc/framework.testbed_model.linux_session.rst create mode 100644 dts/doc/framework.testbed_model.node.rst create mode 100644 dts/doc/framework.testbed_model.os_session.rst create mode 100644 dts/doc/framework.testbed_model.port.rst create mode 100644 dts/doc/framework.testbed_model.posix_session.rst create mode 100644 dts/doc/framework.testbed_model.rst create mode 100644 dts/doc/framework.testbed_model.sut_node.rst create mode 100644 dts/doc/framework.testbed_model.tg_node.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.capturing_traffic_generator.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.scapy.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.traffic_generator
[PATCH v6 0/4] dts: API docs generation
The generation is done with Sphinx, which DPDK already uses, with slightly modified configuration of the sidebar present in an if block. Dependencies are installed using Poetry from the dts directory: poetry install --with docs After installing, enter the Poetry shell: poetry shell And then run the build: ninja -C dts-doc Python3.10 is required to build the DTS API docs. The patchset contains the .rst sources which Sphinx uses to generate the html pages. These were first generated with the sphinx-apidoc utility and modified to provide a better look. The documentation just doesn't look that good without the modifications and there isn't enough configuration options to achieve that without manual changes to the .rst files. This introduces extra maintenance which involves adding new .rst files when a new Python module is added or changing the .rst structure if the Python directory/file structure is changed (moved, renamed files). This small maintenance burden is outweighed by the flexibility afforded by the ability to make manual changes to the .rst files. v2: Removed the use of sphinx-apidoc from meson in favor of adding the files generated by it directly to the repository (and modifying them). v3: Rebase. v4: Rebase. v5: Another rebase, but this time the rebase needed the addition of .rst corresponding to newly added files as well as fixing a few documentation problems in said files. v6: Documentation formatting adjustments. Juraj Linkeš (4): dts: update params and parser docstrings dts: add doc generation dependencies dts: add API doc sources dts: add API doc generation Juraj Linkeš (4): dts: update params and parser docstrings dts: add doc generation dependencies dts: add API doc sources dts: add API doc generation buildtools/call-sphinx-build.py | 31 +- doc/api/doxy-api-index.md | 3 + doc/api/doxy-api.conf.in | 2 + doc/api/meson.build | 11 +- doc/guides/conf.py| 39 +- doc/guides/meson.build| 1 + doc/guides/tools/dts.rst | 34 +- dts/doc/conf_yaml_schema.json | 1 + dts/doc/framework.config.rst | 12 + dts/doc/framework.config.types.rst| 6 + dts/doc/framework.exception.rst | 6 + dts/doc/framework.logger.rst | 6 + dts/doc/framework.params.eal.rst | 6 + dts/doc/framework.params.rst | 14 + dts/doc/framework.params.testpmd.rst | 6 + dts/doc/framework.params.types.rst| 6 + dts/doc/framework.parser.rst | 6 + .../framework.remote_session.dpdk_shell.rst | 6 + ...ote_session.interactive_remote_session.rst | 6 + ...ework.remote_session.interactive_shell.rst | 6 + .../framework.remote_session.python_shell.rst | 6 + ...ramework.remote_session.remote_session.rst | 6 + dts/doc/framework.remote_session.rst | 18 + .../framework.remote_session.ssh_session.rst | 6 + ...framework.remote_session.testpmd_shell.rst | 6 + dts/doc/framework.runner.rst | 6 + dts/doc/framework.settings.rst| 6 + dts/doc/framework.test_result.rst | 6 + dts/doc/framework.test_suite.rst | 6 + dts/doc/framework.testbed_model.cpu.rst | 6 + .../framework.testbed_model.linux_session.rst | 6 + dts/doc/framework.testbed_model.node.rst | 6 + .../framework.testbed_model.os_session.rst| 6 + dts/doc/framework.testbed_model.port.rst | 6 + .../framework.testbed_model.posix_session.rst | 6 + dts/doc/framework.testbed_model.rst | 26 + dts/doc/framework.testbed_model.sut_node.rst | 6 + dts/doc/framework.testbed_model.tg_node.rst | 6 + ..._generator.capturing_traffic_generator.rst | 6 + ...mework.testbed_model.traffic_generator.rst | 14 + testbed_model.traffic_generator.scapy.rst | 6 + ...el.traffic_generator.traffic_generator.rst | 6 + ...framework.testbed_model.virtual_device.rst | 6 + dts/doc/framework.utils.rst | 6 + dts/doc/index.rst | 43 ++ dts/doc/meson.build | 27 + dts/framework/params/__init__.py | 4 +- dts/framework/params/eal.py | 7 +- dts/framework/params/types.py | 3 +- dts/framework/parser.py | 4 +- dts/meson.build | 16 + dts/poetry.lock | 510 +- dts/pyproject.toml| 7 + meson.build | 1 + 54 files changed, 977 insertions(+), 37 deletions(-) create mode 12 dts/doc/conf_yaml_schema.json create mode 100644 dts/doc/framework.config.rst create mode 100644 dts/doc/framework.config.types.rst create mode 1006
[PATCH v6 1/4] dts: update params and parser docstrings
Address a few errors reported by Sphinx when generating documentation: framework/params/__init__.py:docstring of framework.params.modify_str:3: WARNING: Inline interpreted text or phrase reference start-string without end-string. framework/params/eal.py:docstring of framework.params.eal.EalParams:35: WARNING: Definition list ends without a blank line; unexpected unindent. framework/params/types.py:docstring of framework.params.types:8: WARNING: Inline strong start-string without end-string. framework/params/types.py:docstring of framework.params.types:9: WARNING: Inline strong start-string without end-string. framework/parser.py:docstring of framework.parser.TextParser:33: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser:43: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser:49: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser.wrap:8: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser.wrap:9: WARNING: Block quote ends without a blank line; unexpected unindent. Fixes: 87ba4cdc0dbb ("dts: use Unpack for type checking and hinting") Fixes: d70159cb62f5 ("dts: add params manipulation module") Fixes: 967fc62b0a43 ("dts: refactor EAL parameters class") Fixes: 818fe14e3422 ("dts: add parsing utility module") Cc: luca.vizza...@arm.com Signed-off-by: Juraj Linkeš --- dts/framework/params/__init__.py | 4 ++-- dts/framework/params/eal.py | 7 +-- dts/framework/params/types.py| 3 ++- dts/framework/parser.py | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dts/framework/params/__init__.py b/dts/framework/params/__init__.py index 5a6fd93053..1ae227d7b4 100644 --- a/dts/framework/params/__init__.py +++ b/dts/framework/params/__init__.py @@ -53,9 +53,9 @@ def reduced_fn(value): def modify_str(*funcs: FnPtr) -> Callable[[T], T]: -"""Class decorator modifying the ``__str__`` method with a function created from its arguments. +r"""Class decorator modifying the ``__str__`` method with a function created from its arguments. -The :attr:`FnPtr`s fed to the decorator are executed from left to right in the arguments list +The :attr:`FnPtr`\s fed to the decorator are executed from left to right in the arguments list order. Args: diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py index 8d7766fefc..cf1594353a 100644 --- a/dts/framework/params/eal.py +++ b/dts/framework/params/eal.py @@ -26,13 +26,16 @@ class EalParams(Params): prefix: Set the file prefix string with which to start DPDK, e.g.: ``prefix="vf"``. no_pci: Switch to disable PCI bus, e.g.: ``no_pci=True``. vdevs: Virtual devices, e.g.:: + vdevs=[ VirtualDevice('net_ring0'), VirtualDevice('net_ring1') ] + ports: The list of ports to allow. -other_eal_param: user defined DPDK EAL parameters, e.g.: -``other_eal_param='--single-file-segments'`` +other_eal_param: user defined DPDK EAL parameters, e.g.:: + +``other_eal_param='--single-file-segments'`` """ lcore_list: LogicalCoreList | None = field(default=None, metadata=Params.short("l")) diff --git a/dts/framework/params/types.py b/dts/framework/params/types.py index e668f658d8..d77c4625fb 100644 --- a/dts/framework/params/types.py +++ b/dts/framework/params/types.py @@ -6,7 +6,8 @@ TypedDicts can be used in conjunction with Unpack and kwargs for type hinting on function calls. Example: -..code:: python +.. code:: python + def create_testpmd(**kwargs: Unpack[TestPmdParamsDict]): params = TestPmdParams(**kwargs) """ diff --git a/dts/framework/parser.py b/dts/framework/parser.py index 741dfff821..7254c75b71 100644 --- a/dts/framework/parser.py +++ b/dts/framework/parser.py @@ -46,7 +46,7 @@ class TextParser(ABC): Example: The following example makes use of and demonstrates every parser function available: -..code:: python +.. code:: python from dataclasses import dataclass, field from enum import Enum @@ -90,7 +90,7 @@ def wrap(parser_fn: ParserFn, wrapper_fn: Callable) -> ParserFn: """Makes a wrapped parser function. `parser_fn` is called and if a non-None value is returned, `wrapper_function` is called with -it. Otherwise the function returns early with None. In pseudo-code: +it. Otherwise the function returns early with None. In pseudo-code:: intermediate_value := parser_fn(input) if intermediary_value is None then -- 2.34.1
[PATCH v6 2/4] dts: add doc generation dependencies
Sphinx imports every Python module when generating documentation from docstrings, meaning all DTS dependencies, including Python version, must be satisfied. By adding Sphinx to DTS dependencies we provide a convenient way to generate the DTS API docs which satisfies all dependencies. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro --- dts/poetry.lock| 510 +++-- dts/pyproject.toml | 7 + 2 files changed, 505 insertions(+), 12 deletions(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index 5f8fa03933..b6e27f8f38 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -1,5 +1,16 @@ # This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +[[package]] +name = "alabaster" +version = "0.7.13" +description = "A configurable sidebar-enabled Sphinx theme" +optional = false +python-versions = ">=3.6" +files = [ +{file = "alabaster-0.7.13-py3-none-any.whl", hash = "sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3"}, +{file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, +] + [[package]] name = "attrs" version = "23.1.0" @@ -18,6 +29,23 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +[[package]] +name = "babel" +version = "2.13.1" +description = "Internationalization utilities" +optional = false +python-versions = ">=3.7" +files = [ +{file = "Babel-2.13.1-py3-none-any.whl", hash = "sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed"}, +{file = "Babel-2.13.1.tar.gz", hash = "sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900"}, +] + +[package.dependencies] +setuptools = {version = "*", markers = "python_version >= \"3.12\""} + +[package.extras] +dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] + [[package]] name = "bcrypt" version = "4.0.1" @@ -86,6 +114,17 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] +[[package]] +name = "certifi" +version = "2023.7.22" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +files = [ +{file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, +{file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, +] + [[package]] name = "cffi" version = "1.15.1" @@ -162,6 +201,105 @@ files = [ [package.dependencies] pycparser = "*" +[[package]] +name = "charset-normalizer" +version = "3.3.2" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7.0" +files = [ +{file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06
[PATCH v6 3/4] dts: add API doc sources
These sources could be generated with the sphinx-apidoc utility, but that doesn't give us enough flexibility, such as sorting the order of modules or changing the headers of the modules. The sources included in this patch were in fact generated by said utility, but modified to improve the look of the documentation. The improvements are mainly in toctree definitions and the titles of the modules/packages. These were made with specific Sphinx config options in mind. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro --- dts/doc/conf_yaml_schema.json | 1 + dts/doc/framework.config.rst | 12 ++ dts/doc/framework.config.types.rst| 6 +++ dts/doc/framework.exception.rst | 6 +++ dts/doc/framework.logger.rst | 6 +++ dts/doc/framework.params.eal.rst | 6 +++ dts/doc/framework.params.rst | 14 ++ dts/doc/framework.params.testpmd.rst | 6 +++ dts/doc/framework.params.types.rst| 6 +++ dts/doc/framework.parser.rst | 6 +++ .../framework.remote_session.dpdk_shell.rst | 6 +++ ...ote_session.interactive_remote_session.rst | 6 +++ ...ework.remote_session.interactive_shell.rst | 6 +++ .../framework.remote_session.python_shell.rst | 6 +++ ...ramework.remote_session.remote_session.rst | 6 +++ dts/doc/framework.remote_session.rst | 18 .../framework.remote_session.ssh_session.rst | 6 +++ ...framework.remote_session.testpmd_shell.rst | 6 +++ dts/doc/framework.runner.rst | 6 +++ dts/doc/framework.settings.rst| 6 +++ dts/doc/framework.test_result.rst | 6 +++ dts/doc/framework.test_suite.rst | 6 +++ dts/doc/framework.testbed_model.cpu.rst | 6 +++ .../framework.testbed_model.linux_session.rst | 6 +++ dts/doc/framework.testbed_model.node.rst | 6 +++ .../framework.testbed_model.os_session.rst| 6 +++ dts/doc/framework.testbed_model.port.rst | 6 +++ .../framework.testbed_model.posix_session.rst | 6 +++ dts/doc/framework.testbed_model.rst | 26 +++ dts/doc/framework.testbed_model.sut_node.rst | 6 +++ dts/doc/framework.testbed_model.tg_node.rst | 6 +++ ..._generator.capturing_traffic_generator.rst | 6 +++ ...mework.testbed_model.traffic_generator.rst | 14 ++ testbed_model.traffic_generator.scapy.rst | 6 +++ ...el.traffic_generator.traffic_generator.rst | 6 +++ ...framework.testbed_model.virtual_device.rst | 6 +++ dts/doc/framework.utils.rst | 6 +++ dts/doc/index.rst | 43 +++ 38 files changed, 314 insertions(+) create mode 12 dts/doc/conf_yaml_schema.json create mode 100644 dts/doc/framework.config.rst create mode 100644 dts/doc/framework.config.types.rst create mode 100644 dts/doc/framework.exception.rst create mode 100644 dts/doc/framework.logger.rst create mode 100644 dts/doc/framework.params.eal.rst create mode 100644 dts/doc/framework.params.rst create mode 100644 dts/doc/framework.params.testpmd.rst create mode 100644 dts/doc/framework.params.types.rst create mode 100644 dts/doc/framework.parser.rst create mode 100644 dts/doc/framework.remote_session.dpdk_shell.rst create mode 100644 dts/doc/framework.remote_session.interactive_remote_session.rst create mode 100644 dts/doc/framework.remote_session.interactive_shell.rst create mode 100644 dts/doc/framework.remote_session.python_shell.rst create mode 100644 dts/doc/framework.remote_session.remote_session.rst create mode 100644 dts/doc/framework.remote_session.rst create mode 100644 dts/doc/framework.remote_session.ssh_session.rst create mode 100644 dts/doc/framework.remote_session.testpmd_shell.rst create mode 100644 dts/doc/framework.runner.rst create mode 100644 dts/doc/framework.settings.rst create mode 100644 dts/doc/framework.test_result.rst create mode 100644 dts/doc/framework.test_suite.rst create mode 100644 dts/doc/framework.testbed_model.cpu.rst create mode 100644 dts/doc/framework.testbed_model.linux_session.rst create mode 100644 dts/doc/framework.testbed_model.node.rst create mode 100644 dts/doc/framework.testbed_model.os_session.rst create mode 100644 dts/doc/framework.testbed_model.port.rst create mode 100644 dts/doc/framework.testbed_model.posix_session.rst create mode 100644 dts/doc/framework.testbed_model.rst create mode 100644 dts/doc/framework.testbed_model.sut_node.rst create mode 100644 dts/doc/framework.testbed_model.tg_node.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.capturing_traffic_generator.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.scapy.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.traffic_generator
[PATCH v6 4/4] dts: add API doc generation
The tool used to generate DTS API docs is Sphinx, which is already in use in DPDK. The same configuration is used to preserve style with one DTS-specific configuration (so that the DPDK docs are unchanged) that modifies how the sidebar displays the content. Sphinx generates the documentation from Python docstrings. The docstring format is the Google format [0] which requires the sphinx.ext.napoleon extension. The other extension, sphinx.ext.intersphinx, enables linking to object in external documentations, such as the Python documentation. There are two requirements for building DTS docs: * The same Python version as DTS or higher, because Sphinx imports the code. * Also the same Python packages as DTS, for the same reason. [0] https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro Tested-by: Nicholas Pratte --- buildtools/call-sphinx-build.py | 31 ++ doc/api/doxy-api-index.md | 3 +++ doc/api/doxy-api.conf.in| 2 ++ doc/api/meson.build | 11 +++--- doc/guides/conf.py | 39 - doc/guides/meson.build | 1 + doc/guides/tools/dts.rst| 34 +++- dts/doc/meson.build | 27 +++ dts/meson.build | 16 ++ meson.build | 1 + 10 files changed, 147 insertions(+), 18 deletions(-) create mode 100644 dts/doc/meson.build create mode 100644 dts/meson.build diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py index da19e950c9..dff8471560 100755 --- a/buildtools/call-sphinx-build.py +++ b/buildtools/call-sphinx-build.py @@ -3,31 +3,44 @@ # Copyright(c) 2019 Intel Corporation # +import argparse import sys import os from os.path import join from subprocess import run -# assign parameters to variables -(sphinx, version, src, dst, *extra_args) = sys.argv[1:] +parser = argparse.ArgumentParser() +parser.add_argument('sphinx') +parser.add_argument('version') +parser.add_argument('src') +parser.add_argument('dst') +parser.add_argument('--dts-root', default=None) +args, extra_args = parser.parse_known_args() # set the version in environment for sphinx to pick up -os.environ['DPDK_VERSION'] = version +os.environ['DPDK_VERSION'] = args.version +if args.dts_root: +os.environ['DTS_ROOT'] = args.dts_root -sphinx_cmd = [sphinx] + extra_args +sphinx_cmd = [args.sphinx] + extra_args # find all the files sphinx will process so we can write them as dependencies srcfiles = [] -for root, dirs, files in os.walk(src): +for root, dirs, files in os.walk(args.src): srcfiles.extend([join(root, f) for f in files]) +if not os.path.exists(args.dst): +os.makedirs(args.dst) + # run sphinx, putting the html output in a "html" directory -with open(join(dst, 'sphinx_html.out'), 'w') as out: -process = run(sphinx_cmd + ['-b', 'html', src, join(dst, 'html')], - stdout=out) +with open(join(args.dst, 'sphinx_html.out'), 'w') as out: +process = run( +sphinx_cmd + ['-b', 'html', args.src, join(args.dst, 'html')], +stdout=out +) # create a gcc format .d file giving all the dependencies of this doc build -with open(join(dst, '.html.d'), 'w') as d: +with open(join(args.dst, '.html.d'), 'w') as d: d.write('html: ' + ' '.join(srcfiles) + '\n') sys.exit(process.returncode) diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index f9283154f8..cc214ede46 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -244,3 +244,6 @@ The public API headers are grouped by topics: [experimental APIs](@ref rte_compat.h), [ABI versioning](@ref rte_function_versioning.h), [version](@ref rte_version.h) + +- **tests**: + [**DTS**](@dts_api_main_page) diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index a8823c046f..c94f02d411 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -124,6 +124,8 @@ SEARCHENGINE= YES SORT_MEMBER_DOCS= NO SOURCE_BROWSER = YES +ALIASES = "dts_api_main_page=@DTS_API_MAIN_PAGE@" + EXAMPLE_PATH= @TOPDIR@/examples EXAMPLE_PATTERNS= *.c EXAMPLE_RECURSIVE = YES diff --git a/doc/api/meson.build b/doc/api/meson.build index 5b50692df9..ffc75d7b5a 100644 --- a/doc/api/meson.build +++ b/doc/api/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi +doc_api_build_dir = meson.current_build_dir() doxygen = find_program('doxygen', required: get_option('enable_docs')) if not doxygen.found() @@ -32,14 +33,18 @@ example = custom_target('examples.dox', # set up common Doxygen configuration cdata = configuration_data() cdata.set('VERSION', meson.project_version()) -cdata.set('API_EXAMPLES', joi
Re: [PATCH v6 4/4] dts: add API doc generation
On Mon, Jun 24, 2024 at 03:46:00PM +0200, Juraj Linkeš wrote: > The tool used to generate DTS API docs is Sphinx, which is already in > use in DPDK. The same configuration is used to preserve style with one > DTS-specific configuration (so that the DPDK docs are unchanged) that > modifies how the sidebar displays the content. > > Sphinx generates the documentation from Python docstrings. The docstring > format is the Google format [0] which requires the sphinx.ext.napoleon > extension. The other extension, sphinx.ext.intersphinx, enables linking > to object in external documentations, such as the Python documentation. > > There are two requirements for building DTS docs: > * The same Python version as DTS or higher, because Sphinx imports the > code. > * Also the same Python packages as DTS, for the same reason. > > [0] > https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings > > Signed-off-by: Juraj Linkeš > Reviewed-by: Luca Vizzarro > Reviewed-by: Jeremy Spewock > Tested-by: Luca Vizzarro > Tested-by: Nicholas Pratte > --- Acked-by: Bruce Richardson
RE: [PATCH] net/mlx5: fix memleak for resource object
Hi, Thank you very much for the fix. Could you please provide the commit message explaining the problem reported by Coverity and the fix? > -Original Message- > From: Mahmoud Maatuq > Sent: Sunday, June 23, 2024 12:36 > To: Dariusz Sosnowski ; Slava Ovsiienko > ; Bing Zhao ; Ori Kam > ; Suanming Mou ; Matan Azrad > > Cc: dev@dpdk.org; Mahmoud Maatuq > Subject: [PATCH] net/mlx5: fix memleak for resource object > > Coverity issue: 426424 > Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list utility") The issue was introduced in commit 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure"). Fixes tag should reference that commit. > Cc: ma...@nvidia.com > > Signed-off-by: Mahmoud Maatuq > --- > drivers/net/mlx5/mlx5_flow_dv.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c > index d46beffd4c..1010b8e423 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void > *cb_ctx) > items = *((const struct rte_flow_item **)(ctx->data2)); > resource->matcher_object = mlx5dr_bwc_matcher_create > (resource->group->tbl, resource->priority, > items); > - if (!(resource->matcher_object)) > + if (!(resource->matcher_object)) { While we're at it, could you please remove the parentheses around resource->matcher_object? They're redundant. > + mlx5_free(resource); > return NULL; > + } > #else > + mlx5_free(resource); > return NULL; > #endif > } > -- > 2.43.0 Best regards, Dariusz Sosnowski
Re: [PATCH v6 4/4] dts: add API doc generation
Hi Thomas, I believe the only open question in this patch set is the linking of DTS API docs on the main doxygen page. I've left only the parts relevant to the question so that it's easier for us to address it. diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index f9283154f8..cc214ede46 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -244,3 +244,6 @@ The public API headers are grouped by topics: [experimental APIs](@ref rte_compat.h), [ABI versioning](@ref rte_function_versioning.h), [version](@ref rte_version.h) + +- **tests**: + [**DTS**](@dts_api_main_page) diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index a8823c046f..c94f02d411 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -124,6 +124,8 @@ SEARCHENGINE= YES SORT_MEMBER_DOCS= NO SOURCE_BROWSER = YES +ALIASES = "dts_api_main_page=@DTS_API_MAIN_PAGE@" + EXAMPLE_PATH= @TOPDIR@/examples EXAMPLE_PATTERNS= *.c EXAMPLE_RECURSIVE = YES diff --git a/doc/api/meson.build b/doc/api/meson.build index 5b50692df9..ffc75d7b5a 100644 --- a/doc/api/meson.build +++ b/doc/api/meson.build @@ -32,14 +33,18 @@ example = custom_target('examples.dox', # set up common Doxygen configuration cdata = configuration_data() cdata.set('VERSION', meson.project_version()) -cdata.set('API_EXAMPLES', join_paths(dpdk_build_root, 'doc', 'api', 'examples.dox')) -cdata.set('OUTPUT', join_paths(dpdk_build_root, 'doc', 'api')) +cdata.set('API_EXAMPLES', join_paths(doc_api_build_dir, 'examples.dox')) +cdata.set('OUTPUT', doc_api_build_dir) cdata.set('TOPDIR', dpdk_source_root) -cdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, join_paths(dpdk_build_root, 'doc', 'api')])) +cdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, doc_api_build_dir])) These three changes are here only for context, they're not relevant to the linking question. cdata.set('WARN_AS_ERROR', 'NO') if get_option('werror') cdata.set('WARN_AS_ERROR', 'YES') endif +# A local reference must be relative to the main index.html page +# The path below can't be taken from the DTS meson file as that would +# require recursive subdir traversal (doc, dts, then doc again) +cdata.set('DTS_API_MAIN_PAGE', join_paths('..', 'dts', 'html', 'index.html')) This is where the path is actually set.
Re: [PATCH v6 4/4] dts: add API doc generation
24/06/2024 15:46, Juraj Linkeš: > The tool used to generate DTS API docs is Sphinx, which is already in > use in DPDK. The same configuration is used to preserve style with one > DTS-specific configuration (so that the DPDK docs are unchanged) that > modifies how the sidebar displays the content. > > Sphinx generates the documentation from Python docstrings. The docstring > format is the Google format [0] which requires the sphinx.ext.napoleon > extension. The other extension, sphinx.ext.intersphinx, enables linking > to object in external documentations, such as the Python documentation. > > There are two requirements for building DTS docs: > * The same Python version as DTS or higher, because Sphinx imports the > code. > * Also the same Python packages as DTS, for the same reason. > > [0] > https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings > > Signed-off-by: Juraj Linkeš > Reviewed-by: Luca Vizzarro > Reviewed-by: Jeremy Spewock > Tested-by: Luca Vizzarro > Tested-by: Nicholas Pratte > --- > buildtools/call-sphinx-build.py | 31 ++ > doc/api/doxy-api-index.md | 3 +++ > doc/api/doxy-api.conf.in| 2 ++ > doc/api/meson.build | 11 +++--- > doc/guides/conf.py | 39 - > doc/guides/meson.build | 1 + > doc/guides/tools/dts.rst| 34 +++- > dts/doc/meson.build | 27 +++ > dts/meson.build | 16 ++ > meson.build | 1 + > 10 files changed, 147 insertions(+), 18 deletions(-) > create mode 100644 dts/doc/meson.build > create mode 100644 dts/meson.build There are unrelated changes in this patch. Please I would prefer to have existing code changed in a separate patch, so we have only DTS addition in the last patch.
[PATCH v7 0/4] dts: API docs generation
The generation is done with Sphinx, which DPDK already uses, with slightly modified configuration of the sidebar present in an if block. Dependencies are installed using Poetry from the dts directory: poetry install --with docs After installing, enter the Poetry shell: poetry shell And then run the build: ninja -C dts-doc Python3.10 is required to build the DTS API docs. The patchset contains the .rst sources which Sphinx uses to generate the html pages. These were first generated with the sphinx-apidoc utility and modified to provide a better look. The documentation just doesn't look that good without the modifications and there isn't enough configuration options to achieve that without manual changes to the .rst files. This introduces extra maintenance which involves adding new .rst files when a new Python module is added or changing the .rst structure if the Python directory/file structure is changed (moved, renamed files). This small maintenance burden is outweighed by the flexibility afforded by the ability to make manual changes to the .rst files. v2: Removed the use of sphinx-apidoc from meson in favor of adding the files generated by it directly to the repository (and modifying them). v3: Rebase. v4: Rebase. v5: Another rebase, but this time the rebase needed the addition of .rst corresponding to newly added files as well as fixing a few documentation problems in said files. v6: Documentation formatting adjustments. v7: Now with the actual doc changes. Juraj Linkeš (4): dts: update params and parser docstrings dts: add doc generation dependencies dts: add API doc sources dts: add API doc generation buildtools/call-sphinx-build.py | 31 +- doc/api/doxy-api-index.md | 3 + doc/api/doxy-api.conf.in | 2 + doc/api/meson.build | 11 +- doc/guides/conf.py| 39 +- doc/guides/meson.build| 1 + doc/guides/tools/dts.rst | 34 +- dts/doc/conf_yaml_schema.json | 1 + dts/doc/framework.config.rst | 12 + dts/doc/framework.config.types.rst| 6 + dts/doc/framework.exception.rst | 6 + dts/doc/framework.logger.rst | 6 + dts/doc/framework.params.eal.rst | 6 + dts/doc/framework.params.rst | 14 + dts/doc/framework.params.testpmd.rst | 6 + dts/doc/framework.params.types.rst| 6 + dts/doc/framework.parser.rst | 6 + .../framework.remote_session.dpdk_shell.rst | 6 + ...ote_session.interactive_remote_session.rst | 6 + ...ework.remote_session.interactive_shell.rst | 6 + .../framework.remote_session.python_shell.rst | 6 + ...ramework.remote_session.remote_session.rst | 6 + dts/doc/framework.remote_session.rst | 18 + .../framework.remote_session.ssh_session.rst | 6 + ...framework.remote_session.testpmd_shell.rst | 6 + dts/doc/framework.runner.rst | 6 + dts/doc/framework.settings.rst| 6 + dts/doc/framework.test_result.rst | 6 + dts/doc/framework.test_suite.rst | 6 + dts/doc/framework.testbed_model.cpu.rst | 6 + .../framework.testbed_model.linux_session.rst | 6 + dts/doc/framework.testbed_model.node.rst | 6 + .../framework.testbed_model.os_session.rst| 6 + dts/doc/framework.testbed_model.port.rst | 6 + .../framework.testbed_model.posix_session.rst | 6 + dts/doc/framework.testbed_model.rst | 26 + dts/doc/framework.testbed_model.sut_node.rst | 6 + dts/doc/framework.testbed_model.tg_node.rst | 6 + ..._generator.capturing_traffic_generator.rst | 6 + ...mework.testbed_model.traffic_generator.rst | 14 + testbed_model.traffic_generator.scapy.rst | 6 + ...el.traffic_generator.traffic_generator.rst | 6 + ...framework.testbed_model.virtual_device.rst | 6 + dts/doc/framework.utils.rst | 6 + dts/doc/index.rst | 43 ++ dts/doc/meson.build | 27 + dts/framework/params/__init__.py | 4 +- dts/framework/params/eal.py | 7 +- dts/framework/params/types.py | 3 +- dts/framework/parser.py | 4 +- dts/meson.build | 16 + dts/poetry.lock | 510 +- dts/pyproject.toml| 7 + meson.build | 1 + 54 files changed, 977 insertions(+), 37 deletions(-) create mode 12 dts/doc/conf_yaml_schema.json create mode 100644 dts/doc/framework.config.rst create mode 100644 dts/doc/framework.config.types.rst create mode 100644 dts/doc/framework.exception.rst create mode 100644 dts/doc/framework.logger.rst create mode 100644 dts/doc/framewor
[PATCH v7 1/4] dts: update params and parser docstrings
Address a few errors reported by Sphinx when generating documentation: framework/params/__init__.py:docstring of framework.params.modify_str:3: WARNING: Inline interpreted text or phrase reference start-string without end-string. framework/params/eal.py:docstring of framework.params.eal.EalParams:35: WARNING: Definition list ends without a blank line; unexpected unindent. framework/params/types.py:docstring of framework.params.types:8: WARNING: Inline strong start-string without end-string. framework/params/types.py:docstring of framework.params.types:9: WARNING: Inline strong start-string without end-string. framework/parser.py:docstring of framework.parser.TextParser:33: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser:43: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser:49: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser.wrap:8: ERROR: Unexpected indentation. framework/parser.py:docstring of framework.parser.TextParser.wrap:9: WARNING: Block quote ends without a blank line; unexpected unindent. Fixes: 87ba4cdc0dbb ("dts: use Unpack for type checking and hinting") Fixes: d70159cb62f5 ("dts: add params manipulation module") Fixes: 967fc62b0a43 ("dts: refactor EAL parameters class") Fixes: 818fe14e3422 ("dts: add parsing utility module") Cc: luca.vizza...@arm.com Signed-off-by: Juraj Linkeš --- dts/framework/params/__init__.py | 4 ++-- dts/framework/params/eal.py | 7 +-- dts/framework/params/types.py| 3 ++- dts/framework/parser.py | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dts/framework/params/__init__.py b/dts/framework/params/__init__.py index 5a6fd93053..1ae227d7b4 100644 --- a/dts/framework/params/__init__.py +++ b/dts/framework/params/__init__.py @@ -53,9 +53,9 @@ def reduced_fn(value): def modify_str(*funcs: FnPtr) -> Callable[[T], T]: -"""Class decorator modifying the ``__str__`` method with a function created from its arguments. +r"""Class decorator modifying the ``__str__`` method with a function created from its arguments. -The :attr:`FnPtr`s fed to the decorator are executed from left to right in the arguments list +The :attr:`FnPtr`\s fed to the decorator are executed from left to right in the arguments list order. Args: diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py index 8d7766fefc..cf1594353a 100644 --- a/dts/framework/params/eal.py +++ b/dts/framework/params/eal.py @@ -26,13 +26,16 @@ class EalParams(Params): prefix: Set the file prefix string with which to start DPDK, e.g.: ``prefix="vf"``. no_pci: Switch to disable PCI bus, e.g.: ``no_pci=True``. vdevs: Virtual devices, e.g.:: + vdevs=[ VirtualDevice('net_ring0'), VirtualDevice('net_ring1') ] + ports: The list of ports to allow. -other_eal_param: user defined DPDK EAL parameters, e.g.: -``other_eal_param='--single-file-segments'`` +other_eal_param: user defined DPDK EAL parameters, e.g.:: + +``other_eal_param='--single-file-segments'`` """ lcore_list: LogicalCoreList | None = field(default=None, metadata=Params.short("l")) diff --git a/dts/framework/params/types.py b/dts/framework/params/types.py index e668f658d8..d77c4625fb 100644 --- a/dts/framework/params/types.py +++ b/dts/framework/params/types.py @@ -6,7 +6,8 @@ TypedDicts can be used in conjunction with Unpack and kwargs for type hinting on function calls. Example: -..code:: python +.. code:: python + def create_testpmd(**kwargs: Unpack[TestPmdParamsDict]): params = TestPmdParams(**kwargs) """ diff --git a/dts/framework/parser.py b/dts/framework/parser.py index 741dfff821..7254c75b71 100644 --- a/dts/framework/parser.py +++ b/dts/framework/parser.py @@ -46,7 +46,7 @@ class TextParser(ABC): Example: The following example makes use of and demonstrates every parser function available: -..code:: python +.. code:: python from dataclasses import dataclass, field from enum import Enum @@ -90,7 +90,7 @@ def wrap(parser_fn: ParserFn, wrapper_fn: Callable) -> ParserFn: """Makes a wrapped parser function. `parser_fn` is called and if a non-None value is returned, `wrapper_function` is called with -it. Otherwise the function returns early with None. In pseudo-code: +it. Otherwise the function returns early with None. In pseudo-code:: intermediate_value := parser_fn(input) if intermediary_value is None then -- 2.34.1
[PATCH v7 2/4] dts: add doc generation dependencies
Sphinx imports every Python module when generating documentation from docstrings, meaning all DTS dependencies, including Python version, must be satisfied. By adding Sphinx to DTS dependencies we provide a convenient way to generate the DTS API docs which satisfies all dependencies. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro --- dts/poetry.lock| 510 +++-- dts/pyproject.toml | 7 + 2 files changed, 505 insertions(+), 12 deletions(-) diff --git a/dts/poetry.lock b/dts/poetry.lock index 5f8fa03933..b6e27f8f38 100644 --- a/dts/poetry.lock +++ b/dts/poetry.lock @@ -1,5 +1,16 @@ # This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +[[package]] +name = "alabaster" +version = "0.7.13" +description = "A configurable sidebar-enabled Sphinx theme" +optional = false +python-versions = ">=3.6" +files = [ +{file = "alabaster-0.7.13-py3-none-any.whl", hash = "sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3"}, +{file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, +] + [[package]] name = "attrs" version = "23.1.0" @@ -18,6 +29,23 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +[[package]] +name = "babel" +version = "2.13.1" +description = "Internationalization utilities" +optional = false +python-versions = ">=3.7" +files = [ +{file = "Babel-2.13.1-py3-none-any.whl", hash = "sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed"}, +{file = "Babel-2.13.1.tar.gz", hash = "sha256:33e0952d7dd6374af8dbf6768cc4ddf3ccfefc244f9986d4074704f2fbd18900"}, +] + +[package.dependencies] +setuptools = {version = "*", markers = "python_version >= \"3.12\""} + +[package.extras] +dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] + [[package]] name = "bcrypt" version = "4.0.1" @@ -86,6 +114,17 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] +[[package]] +name = "certifi" +version = "2023.7.22" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +files = [ +{file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, +{file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, +] + [[package]] name = "cffi" version = "1.15.1" @@ -162,6 +201,105 @@ files = [ [package.dependencies] pycparser = "*" +[[package]] +name = "charset-normalizer" +version = "3.3.2" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7.0" +files = [ +{file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, +{file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06
[PATCH v7 3/4] dts: add API doc sources
These sources could be generated with the sphinx-apidoc utility, but that doesn't give us enough flexibility, such as sorting the order of modules or changing the headers of the modules. The sources included in this patch were in fact generated by said utility, but modified to improve the look of the documentation. The improvements are mainly in toctree definitions and the titles of the modules/packages. These were made with specific Sphinx config options in mind. Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Tested-by: Luca Vizzarro --- dts/doc/conf_yaml_schema.json | 1 + dts/doc/framework.config.rst | 12 ++ dts/doc/framework.config.types.rst| 6 +++ dts/doc/framework.exception.rst | 6 +++ dts/doc/framework.logger.rst | 6 +++ dts/doc/framework.params.eal.rst | 6 +++ dts/doc/framework.params.rst | 14 ++ dts/doc/framework.params.testpmd.rst | 6 +++ dts/doc/framework.params.types.rst| 6 +++ dts/doc/framework.parser.rst | 6 +++ .../framework.remote_session.dpdk_shell.rst | 6 +++ ...ote_session.interactive_remote_session.rst | 6 +++ ...ework.remote_session.interactive_shell.rst | 6 +++ .../framework.remote_session.python_shell.rst | 6 +++ ...ramework.remote_session.remote_session.rst | 6 +++ dts/doc/framework.remote_session.rst | 18 .../framework.remote_session.ssh_session.rst | 6 +++ ...framework.remote_session.testpmd_shell.rst | 6 +++ dts/doc/framework.runner.rst | 6 +++ dts/doc/framework.settings.rst| 6 +++ dts/doc/framework.test_result.rst | 6 +++ dts/doc/framework.test_suite.rst | 6 +++ dts/doc/framework.testbed_model.cpu.rst | 6 +++ .../framework.testbed_model.linux_session.rst | 6 +++ dts/doc/framework.testbed_model.node.rst | 6 +++ .../framework.testbed_model.os_session.rst| 6 +++ dts/doc/framework.testbed_model.port.rst | 6 +++ .../framework.testbed_model.posix_session.rst | 6 +++ dts/doc/framework.testbed_model.rst | 26 +++ dts/doc/framework.testbed_model.sut_node.rst | 6 +++ dts/doc/framework.testbed_model.tg_node.rst | 6 +++ ..._generator.capturing_traffic_generator.rst | 6 +++ ...mework.testbed_model.traffic_generator.rst | 14 ++ testbed_model.traffic_generator.scapy.rst | 6 +++ ...el.traffic_generator.traffic_generator.rst | 6 +++ ...framework.testbed_model.virtual_device.rst | 6 +++ dts/doc/framework.utils.rst | 6 +++ dts/doc/index.rst | 43 +++ 38 files changed, 314 insertions(+) create mode 12 dts/doc/conf_yaml_schema.json create mode 100644 dts/doc/framework.config.rst create mode 100644 dts/doc/framework.config.types.rst create mode 100644 dts/doc/framework.exception.rst create mode 100644 dts/doc/framework.logger.rst create mode 100644 dts/doc/framework.params.eal.rst create mode 100644 dts/doc/framework.params.rst create mode 100644 dts/doc/framework.params.testpmd.rst create mode 100644 dts/doc/framework.params.types.rst create mode 100644 dts/doc/framework.parser.rst create mode 100644 dts/doc/framework.remote_session.dpdk_shell.rst create mode 100644 dts/doc/framework.remote_session.interactive_remote_session.rst create mode 100644 dts/doc/framework.remote_session.interactive_shell.rst create mode 100644 dts/doc/framework.remote_session.python_shell.rst create mode 100644 dts/doc/framework.remote_session.remote_session.rst create mode 100644 dts/doc/framework.remote_session.rst create mode 100644 dts/doc/framework.remote_session.ssh_session.rst create mode 100644 dts/doc/framework.remote_session.testpmd_shell.rst create mode 100644 dts/doc/framework.runner.rst create mode 100644 dts/doc/framework.settings.rst create mode 100644 dts/doc/framework.test_result.rst create mode 100644 dts/doc/framework.test_suite.rst create mode 100644 dts/doc/framework.testbed_model.cpu.rst create mode 100644 dts/doc/framework.testbed_model.linux_session.rst create mode 100644 dts/doc/framework.testbed_model.node.rst create mode 100644 dts/doc/framework.testbed_model.os_session.rst create mode 100644 dts/doc/framework.testbed_model.port.rst create mode 100644 dts/doc/framework.testbed_model.posix_session.rst create mode 100644 dts/doc/framework.testbed_model.rst create mode 100644 dts/doc/framework.testbed_model.sut_node.rst create mode 100644 dts/doc/framework.testbed_model.tg_node.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.capturing_traffic_generator.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.scapy.rst create mode 100644 dts/doc/framework.testbed_model.traffic_generator.traffic_generator
[PATCH v7 4/4] dts: add API doc generation
The tool used to generate DTS API docs is Sphinx, which is already in use in DPDK. The same configuration is used to preserve style with one DTS-specific configuration (so that the DPDK docs are unchanged) that modifies how the sidebar displays the content. Sphinx generates the documentation from Python docstrings. The docstring format is the Google format [0] which requires the sphinx.ext.napoleon extension. The other extension, sphinx.ext.intersphinx, enables linking to object in external documentations, such as the Python documentation. There are two requirements for building DTS docs: * The same Python version as DTS or higher, because Sphinx imports the code. * Also the same Python packages as DTS, for the same reason. [0] https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings Signed-off-by: Juraj Linkeš Reviewed-by: Luca Vizzarro Reviewed-by: Jeremy Spewock Acked-by: Bruce Richardson Tested-by: Luca Vizzarro Tested-by: Nicholas Pratte --- buildtools/call-sphinx-build.py | 31 ++ doc/api/doxy-api-index.md | 3 +++ doc/api/doxy-api.conf.in| 2 ++ doc/api/meson.build | 11 +++--- doc/guides/conf.py | 39 - doc/guides/meson.build | 1 + doc/guides/tools/dts.rst| 34 +++- dts/doc/meson.build | 27 +++ dts/meson.build | 16 ++ meson.build | 1 + 10 files changed, 147 insertions(+), 18 deletions(-) create mode 100644 dts/doc/meson.build create mode 100644 dts/meson.build diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py index da19e950c9..dff8471560 100755 --- a/buildtools/call-sphinx-build.py +++ b/buildtools/call-sphinx-build.py @@ -3,31 +3,44 @@ # Copyright(c) 2019 Intel Corporation # +import argparse import sys import os from os.path import join from subprocess import run -# assign parameters to variables -(sphinx, version, src, dst, *extra_args) = sys.argv[1:] +parser = argparse.ArgumentParser() +parser.add_argument('sphinx') +parser.add_argument('version') +parser.add_argument('src') +parser.add_argument('dst') +parser.add_argument('--dts-root', default=None) +args, extra_args = parser.parse_known_args() # set the version in environment for sphinx to pick up -os.environ['DPDK_VERSION'] = version +os.environ['DPDK_VERSION'] = args.version +if args.dts_root: +os.environ['DTS_ROOT'] = args.dts_root -sphinx_cmd = [sphinx] + extra_args +sphinx_cmd = [args.sphinx] + extra_args # find all the files sphinx will process so we can write them as dependencies srcfiles = [] -for root, dirs, files in os.walk(src): +for root, dirs, files in os.walk(args.src): srcfiles.extend([join(root, f) for f in files]) +if not os.path.exists(args.dst): +os.makedirs(args.dst) + # run sphinx, putting the html output in a "html" directory -with open(join(dst, 'sphinx_html.out'), 'w') as out: -process = run(sphinx_cmd + ['-b', 'html', src, join(dst, 'html')], - stdout=out) +with open(join(args.dst, 'sphinx_html.out'), 'w') as out: +process = run( +sphinx_cmd + ['-b', 'html', args.src, join(args.dst, 'html')], +stdout=out +) # create a gcc format .d file giving all the dependencies of this doc build -with open(join(dst, '.html.d'), 'w') as d: +with open(join(args.dst, '.html.d'), 'w') as d: d.write('html: ' + ' '.join(srcfiles) + '\n') sys.exit(process.returncode) diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index f9283154f8..cc214ede46 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -244,3 +244,6 @@ The public API headers are grouped by topics: [experimental APIs](@ref rte_compat.h), [ABI versioning](@ref rte_function_versioning.h), [version](@ref rte_version.h) + +- **tests**: + [**DTS**](@dts_api_main_page) diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index a8823c046f..c94f02d411 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -124,6 +124,8 @@ SEARCHENGINE= YES SORT_MEMBER_DOCS= NO SOURCE_BROWSER = YES +ALIASES = "dts_api_main_page=@DTS_API_MAIN_PAGE@" + EXAMPLE_PATH= @TOPDIR@/examples EXAMPLE_PATTERNS= *.c EXAMPLE_RECURSIVE = YES diff --git a/doc/api/meson.build b/doc/api/meson.build index 5b50692df9..ffc75d7b5a 100644 --- a/doc/api/meson.build +++ b/doc/api/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi +doc_api_build_dir = meson.current_build_dir() doxygen = find_program('doxygen', required: get_option('enable_docs')) if not doxygen.found() @@ -32,14 +33,18 @@ example = custom_target('examples.dox', # set up common Doxygen configuration cdata = configuration_data() cdata.set('VERSION', meson.project_version()) -c
Re: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation API
Acked-by: Kai Ji From: Dooley, Brian Sent: 05 June 2024 09:48 To: Ji, Kai ; De Lara Guarch, Pablo Cc: dev@dpdk.org ; gak...@marvell.com ; Dooley, Brian Subject: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation API From: Pablo de Lara IPSec Multi-buffer library v1.4 added a new API to calculate inner/outer padding for HMAC-SHAx/MD5. Signed-off-by: Pablo de Lara Signed-off-by: Brian Dooley --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index 69a546697b..b3fdea02ff 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -13,6 +13,7 @@ struct aesni_mb_op_buf_data { uint32_t offset; }; +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM /** * Calculate the authentication pre-computes * @@ -55,6 +56,7 @@ calculate_auth_precomputes(hash_one_block_t one_block_hash, memset(ipad_buf, 0, blocksize); memset(opad_buf, 0, blocksize); } +#endif static inline int is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode) @@ -66,12 +68,14 @@ is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode) /** Set session authentication parameters */ static int -aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, +aesni_mb_set_session_auth_parameters(IMB_MGR *mb_mgr, struct aesni_mb_session *sess, const struct rte_crypto_sym_xform *xform) { +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM hash_one_block_t hash_oneblock_fn = NULL; unsigned int key_larger_block_size = 0; +#endif uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] = { 0 }; uint32_t auth_precompute = 1; @@ -267,18 +271,24 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, switch (xform->auth.algo) { case RTE_CRYPTO_AUTH_MD5_HMAC: sess->template_job.hash_alg = IMB_AUTH_MD5; +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM hash_oneblock_fn = mb_mgr->md5_one_block; +#endif break; case RTE_CRYPTO_AUTH_SHA1_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_1; +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM hash_oneblock_fn = mb_mgr->sha1_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_1)) { IMB_SHA1(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM key_larger_block_size = 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA1: @@ -287,14 +297,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA224_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_224; +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM hash_oneblock_fn = mb_mgr->sha224_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_224)) { IMB_SHA224(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM key_larger_block_size = 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA224: @@ -303,14 +317,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA256_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_256; +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM hash_oneblock_fn = mb_mgr->sha256_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_256)) { IMB_SHA256(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM key_larger_block_size = 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA256: @@ -319,14 +337,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA384_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_384; +#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM hash_oneblock_fn = mb_mgr->sha384_one_block; +#endif i
[PATCH] vhost: only emit debug log with invalid FD
This patch improves the FD manager logging in case of FD removal from the epoll FD set failure. When the FD is not more valid, like for example if it has already been closed, only emit a debug log and not an error one. Fixes: 0e38b42bf61c ("vhost: manage FD with epoll") Reported-by: David Marchand Signed-off-by: Maxime Coquelin --- lib/vhost/fd_man.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c index 87a8dc3f3e..9bc7e50b93 100644 --- a/lib/vhost/fd_man.c +++ b/lib/vhost/fd_man.c @@ -256,9 +256,14 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) static void fdset_del_locked(struct fdset *pfdset, struct fdentry *pfdentry) { - if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1) - VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s", - pfdentry->fd, pfdset->epfd, strerror(errno)); + if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1) { + if (errno == EBADF) /* File might have already been closed. */ + VHOST_FDMAN_LOG(DEBUG, "could not remove %d fd from %d epfd: %s", + pfdentry->fd, pfdset->epfd, strerror(errno)); + else + VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s", + pfdentry->fd, pfdset->epfd, strerror(errno)); + } fdset_remove_entry(pfdset, pfdentry); } -- 2.45.1
[PATCH v2 0/9] test-bbdev fixes and improvements for 24.07
v2: Added defines for MLD calculation constants. v1:This series targets test-bbdev changes for 24.07. It includes test fixes, iter-max argument change (after deprecation notice in previous releases) and general test improvements. Hernan Vargas (9): test/bbdev: fix TB logic test/bbdev: fix MLD output size computation test/bbdev: fix interrupt tests test/bbdev: change iter-max argument test/bbdev: improve timeout message format test/bbdev: add soft output parsing capability test/bbdev: check assumptions on fft window test/bbdev: update fft measurement output test/bbdev: remove unnecessary line app/test-bbdev/test-bbdev.py | 38 +++--- app/test-bbdev/test_bbdev.c| 1 - app/test-bbdev/test_bbdev_perf.c | 191 - app/test-bbdev/test_bbdev_vector.c | 18 +++ app/test-bbdev/test_bbdev_vector.h | 2 + 5 files changed, 177 insertions(+), 73 deletions(-) -- 2.37.1
[PATCH v2 2/9] test/bbdev: fix MLD output size computation
For perf tests, the operation size for the MLD-TS was incorrect. Fixed so that the performance numbers are correct. Largely cosmetic only. Fixes: 95f192a40e35 ("test/bbdev: add MLD cases") Cc: sta...@dpdk.org Signed-off-by: Hernan Vargas --- app/test-bbdev/test_bbdev_perf.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 6d9bf3a233ec..9841464922ac 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -94,6 +94,8 @@ #define K0_2_2 25 /* K0 fraction numerator for rv 2 and BG 2 */ #define K0_3_1 56 /* K0 fraction numerator for rv 3 and BG 1 */ #define K0_3_2 43 /* K0 fraction numerator for rv 3 and BG 2 */ +#define NUM_SC_PER_RB (12) /* Number of subcarriers in a RB in 3GPP. */ +#define BITS_PER_LLR (8) /* Number of bits in a LLR. */ #define HARQ_MEM_TOLERANCE 256 static struct test_bbdev_vector test_vector; @@ -2896,8 +2898,14 @@ calc_fft_size(struct rte_bbdev_fft_op *op) static uint32_t calc_mldts_size(struct rte_bbdev_mldts_op *op) { - uint32_t output_size; - output_size = op->mldts.num_layers * op->mldts.num_rbs * op->mldts.c_rep; + uint32_t output_size = 0; + uint16_t i; + + for (i = 0; i < op->mldts.num_layers; i++) + output_size += op->mldts.q_m[i]; + + output_size *= NUM_SC_PER_RB * BITS_PER_LLR * op->mldts.num_rbs * (op->mldts.c_rep + 1); + return output_size; } -- 2.37.1
[PATCH v2 1/9] test/bbdev: fix TB logic
Fix discrepancy in logic when using large fake mbuf. Fixes: fd96ef3787f1 ("test/bbdev: extend support for large TB") Cc: sta...@dpdk.org Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test_bbdev_perf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index a21c9c7bddf5..6d9bf3a233ec 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -2131,7 +2131,8 @@ validate_op_chain(struct rte_bbdev_op_data *op, uint16_t data_len = rte_pktmbuf_data_len(m) - offset; total_data_size += orig_op->segments[i].length; - if (orig_op->segments[i].length > RTE_BBDEV_LDPC_E_MAX_MBUF) + if ((orig_op->segments[i].length + RTE_PKTMBUF_HEADROOM) + > RTE_BBDEV_LDPC_E_MAX_MBUF) ignore_mbuf = true; if (!ignore_mbuf) TEST_ASSERT(orig_op->segments[i].length == data_len, -- 2.37.1
[PATCH v2 4/9] test/bbdev: change iter-max argument
-t --iter-max used for max number of iterations. -T --timeout used for test timeout value. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test-bbdev.py | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/test-bbdev/test-bbdev.py b/app/test-bbdev/test-bbdev.py index 65a34390548d..9ddca9e78d3b 100755 --- a/app/test-bbdev/test-bbdev.py +++ b/app/test-bbdev/test-bbdev.py @@ -27,16 +27,10 @@ def kill(process): parser.add_argument("-e", "--eal-params", help="EAL arguments which must be passed to the test app", default="--vdev=baseband_null0 -a00:00.0") -# Until deprecated in next release keep -t as an valid argument for timeout, then use -T -parser.add_argument("-t", "--timeout", +parser.add_argument("-T", "--timeout", type=int, help="Timeout in seconds", default=600) -# This will become -t option for iter_max in next release -parser.add_argument("--iter-max", -type=int, -help="Max iterations", -default=6) parser.add_argument("-c", "--test-cases", nargs="+", help="Defines test cases to run. Run all if not specified") @@ -58,6 +52,10 @@ def kill(process): type=int, help="SNR in dB for BLER tests", default=0) +parser.add_argument("-t", "--iter-max", +type=int, +help="Max iterations", +default=6) parser.add_argument("-l", "--num-lcores", type=int, help="Number of lcores to run.", @@ -83,10 +81,6 @@ def kill(process): if args.iter_max: params.extend(["-t", str(args.iter_max)]) -print("The argument for iter_max will be -t in next release") - -if args.timeout: -print("The argument for timeout will be -T in next release") if args.num_ops: params.extend(["-n", str(args.num_ops)]) -- 2.37.1
[PATCH v2 5/9] test/bbdev: improve timeout message format
Print more info and format message for test timeouts. No functional impact. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test-bbdev.py | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/test-bbdev/test-bbdev.py b/app/test-bbdev/test-bbdev.py index 9ddca9e78d3b..d5b679f7867f 100755 --- a/app/test-bbdev/test-bbdev.py +++ b/app/test-bbdev/test-bbdev.py @@ -108,15 +108,29 @@ def kill(process): try: output = subprocess.run(call_params, timeout=args.timeout, universal_newlines=True) except subprocess.TimeoutExpired as e: + print("===") print("Starting Test Suite : BBdev TimeOut Tests") +print("INFO: One of the tests timed out {}".format(e)) +print("INFO: Unexpected Error") +print("+ --- +") print("== test: timeout") -print("TestCase [ 0] : timeout passed") -print(" + Tests Failed : 1") print("Unexpected Error") +print("TestCase [ 0] : timeout failed") +print(" + ~~ +") +print(" + Tests Failed : 1") +print(" + ~~ +") +exit_status = 1 if output.returncode < 0: + print("===") print("Starting Test Suite : BBdev Exception Tests") +print("INFO: One of the tests returned {}".format(output.returncode)) +print("INFO: Unexpected Error") +print("+ --- +") print("== test: exception") -print("TestCase [ 0] : exception passed") -print(" + Tests Failed : 1") print("Unexpected Error") +print("TestCase [ 0] : exception failed") +print(" + ~~ +") +print(" + Tests Failed : 1") +print(" + ~~ +") +exit_status = 1 sys.exit(exit_status) -- 2.37.1
[PATCH v2 6/9] test/bbdev: add soft output parsing capability
Add vector parsing capability for soft output vectors. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test_bbdev_vector.c | 4 1 file changed, 4 insertions(+) diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index 42fa630041e9..b3e9d4bb7504 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -837,6 +837,10 @@ parse_ldpc_decoder_params(const char *key_token, char *token, ret = parse_data_entry(key_token, token, vector, DATA_HARQ_OUTPUT, op_data_prefixes[DATA_HARQ_OUTPUT]); + else if (starts_with(key_token, op_data_prefixes[DATA_SOFT_OUTPUT])) + ret = parse_data_entry(key_token, token, vector, + DATA_SOFT_OUTPUT, + op_data_prefixes[DATA_SOFT_OUTPUT]); else if (!strcmp(key_token, "e")) { vector->mask |= TEST_BBDEV_VF_E; ldpc_dec->cb_params.e = (uint32_t) strtoul(token, &err, 0); -- 2.37.1
[PATCH v2 7/9] test/bbdev: check assumptions on fft window
Add check for FFT window width. Signed-off-by: Hernan Vargas --- app/test-bbdev/test_bbdev_perf.c | 26 ++ app/test-bbdev/test_bbdev_vector.c | 14 ++ app/test-bbdev/test_bbdev_vector.h | 2 ++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 20cd8df19be7..7c414ab360a8 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -108,6 +108,8 @@ static int ldpc_llr_decimals; static int ldpc_llr_size; /* Keep track of the LDPC decoder device capability flag */ static uint32_t ldpc_cap_flags; +/* FFT window width predefined on device and on vector. */ +static int fft_window_width_dev; /* Represents tested active devices */ static struct active_device { @@ -883,6 +885,13 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info, rte_bbdev_info_get(dev_id, info); if (info->drv.device_status == RTE_BBDEV_DEV_FATAL_ERR) printf("Device Status %s\n", rte_bbdev_device_status_str(info->drv.device_status)); + if (info->drv.fft_window_width != NULL) + fft_window_width_dev = info->drv.fft_window_width[0]; + else + fft_window_width_dev = 0; + if (fft_window_width_dev != 0) + printf(" FFT Window0 width %d\n", fft_window_width_dev); + nb_queues = RTE_MIN(rte_lcore_count(), info->drv.max_num_queues); nb_queues = RTE_MIN(nb_queues, (unsigned int) MAX_QUEUES); @@ -2585,7 +2594,8 @@ validate_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n, } static inline int -validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op) +validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op, + bool skip_validate_output) { struct rte_mbuf *m = op->data; uint8_t i, nb_dst_segments = orig_op->nb_segments; @@ -2615,7 +2625,7 @@ validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig abs_delt = delt > 0 ? delt : -delt; error_num += (abs_delt > thres_hold ? 1 : 0); } - if (error_num > 0) { + if ((error_num > 0) && !skip_validate_output) { rte_memdump(stdout, "Buffer A", ref_out, data_len); rte_memdump(stdout, "Buffer B", op_out, data_len); TEST_ASSERT(error_num == 0, @@ -2688,16 +2698,24 @@ validate_fft_op(struct rte_bbdev_fft_op **ops, const uint16_t n, int ret; struct op_data_entries *fft_data_orig = &test_vector.entries[DATA_HARD_OUTPUT]; struct op_data_entries *fft_pwr_orig = &test_vector.entries[DATA_SOFT_OUTPUT]; + bool skip_validate_output = false; + + if ((test_vector.fft_window_width_vec > 0) && + (test_vector.fft_window_width_vec != fft_window_width_dev)) { + printf("The vector FFT width doesn't match with device - skip %d %d\n", + test_vector.fft_window_width_vec, fft_window_width_dev); + skip_validate_output = true; + } for (i = 0; i < n; ++i) { ret = check_fft_status_and_ordering(ops[i], i, ref_op->status); TEST_ASSERT_SUCCESS(ret, "Checking status and ordering for FFT failed"); TEST_ASSERT_SUCCESS(validate_op_fft_chain( - &ops[i]->fft.base_output, fft_data_orig), + &ops[i]->fft.base_output, fft_data_orig, skip_validate_output), "FFT Output buffers (op=%u) are not matched", i); if (check_bit(ops[i]->fft.op_flags, RTE_BBDEV_FFT_POWER_MEAS)) TEST_ASSERT_SUCCESS(validate_op_fft_chain( - &ops[i]->fft.power_meas_output, fft_pwr_orig), + &ops[i]->fft.power_meas_output, fft_pwr_orig, skip_validate_output), "FFT Power Output buffers (op=%u) are not matched", i); } diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index b3e9d4bb7504..e48947b211ac 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -1050,6 +1050,20 @@ parse_fft_params(const char *key_token, char *token, } } ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; + } else if (!strcmp(key_token, "fft_window_width")) { + tok = strtok(token, VALUE_DELIMITER); + if (tok == NULL) + return -1; + for (i = 0; i < FFT_WIN_SIZE; i++) { + if (i == 0) + vector->fft_window_width_vec = (uint32_t) strtoul(tok, &err, 0); + if (i < (FFT_WIN_SIZE - 1))
[PATCH v2 8/9] test/bbdev: update fft measurement output
Update check for FFT measurement output to better account for tolerance. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test_bbdev_perf.c | 52 +++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 7c414ab360a8..3a94f15a30b8 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -2639,6 +2639,56 @@ validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig return TEST_SUCCESS; } +static inline int +validate_op_fft_meas_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op, + bool skip_validate_output) +{ + struct rte_mbuf *m = op->data; + uint8_t i, nb_dst_segments = orig_op->nb_segments; + double thres_hold = 1.0; + uint32_t j, data_len_iq, error_num; + int32_t *ref_out, *op_out; + double estSNR, refSNR, delt, abs_delt; + + TEST_ASSERT(nb_dst_segments == m->nb_segs, + "Number of segments differ in original (%u) and filled (%u) op fft", + nb_dst_segments, m->nb_segs); + + /* Due to size limitation of mbuf, FFT doesn't use real mbuf. */ + for (i = 0; i < nb_dst_segments; ++i) { + uint16_t offset = (i == 0) ? op->offset : 0; + uint32_t data_len = op->length; + + TEST_ASSERT(orig_op->segments[i].length == data_len, + "Length of segment differ in original (%u) and filled (%u) op fft", + orig_op->segments[i].length, data_len); + + /* Divided by 4 to get the number of 32 bits data. */ + data_len_iq = data_len >> 2; + ref_out = (int32_t *)(orig_op->segments[i].addr); + op_out = rte_pktmbuf_mtod_offset(m, int32_t *, offset); + error_num = 0; + for (j = 0; j < data_len_iq; j++) { + estSNR = 10*log10(op_out[j]); + refSNR = 10*log10(ref_out[j]); + delt = refSNR - estSNR; + abs_delt = delt > 0 ? delt : -delt; + error_num += (abs_delt > thres_hold ? 1 : 0); + } + if ((error_num > 0) && !skip_validate_output) { + rte_memdump(stdout, "Buffer A", ref_out, data_len); + rte_memdump(stdout, "Buffer B", op_out, data_len); + TEST_ASSERT(error_num == 0, + "FFT Output are not matched total (%u) errors (%u)", + data_len_iq, error_num); + } + + m = m->next; + } + + return TEST_SUCCESS; +} + static inline int validate_op_mldts_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op) @@ -2714,7 +2764,7 @@ validate_fft_op(struct rte_bbdev_fft_op **ops, const uint16_t n, &ops[i]->fft.base_output, fft_data_orig, skip_validate_output), "FFT Output buffers (op=%u) are not matched", i); if (check_bit(ops[i]->fft.op_flags, RTE_BBDEV_FFT_POWER_MEAS)) - TEST_ASSERT_SUCCESS(validate_op_fft_chain( + TEST_ASSERT_SUCCESS(validate_op_fft_meas_chain( &ops[i]->fft.power_meas_output, fft_pwr_orig, skip_validate_output), "FFT Power Output buffers (op=%u) are not matched", i); } -- 2.37.1
[PATCH v2 3/9] test/bbdev: fix interrupt tests
Fix possible error with regards to setting the burst size from the enqueue thread. Fixes: b2e2aec3239e ("app/bbdev: enhance interrupt test") Cc: sta...@dpdk.org Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test_bbdev_perf.c | 98 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 9841464922ac..20cd8df19be7 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -3419,15 +3419,6 @@ throughput_intr_lcore_ldpc_dec(void *arg) if (unlikely(num_to_process - enqueued < num_to_enq)) num_to_enq = num_to_process - enqueued; - enq = 0; - do { - enq += rte_bbdev_enqueue_ldpc_dec_ops( - tp->dev_id, - queue_id, &ops[enqueued], - num_to_enq); - } while (unlikely(num_to_enq != enq)); - enqueued += enq; - /* Write to thread burst_sz current number of enqueued * descriptors. It ensures that proper number of * descriptors will be dequeued in callback @@ -3438,6 +3429,15 @@ throughput_intr_lcore_ldpc_dec(void *arg) rte_atomic_store_explicit(&tp->burst_sz, num_to_enq, rte_memory_order_relaxed); + enq = 0; + do { + enq += rte_bbdev_enqueue_ldpc_dec_ops( + tp->dev_id, + queue_id, &ops[enqueued], + num_to_enq); + } while (unlikely(num_to_enq != enq)); + enqueued += enq; + /* Wait until processing of previous batch is * completed */ @@ -3514,14 +3514,6 @@ throughput_intr_lcore_dec(void *arg) if (unlikely(num_to_process - enqueued < num_to_enq)) num_to_enq = num_to_process - enqueued; - enq = 0; - do { - enq += rte_bbdev_enqueue_dec_ops(tp->dev_id, - queue_id, &ops[enqueued], - num_to_enq); - } while (unlikely(num_to_enq != enq)); - enqueued += enq; - /* Write to thread burst_sz current number of enqueued * descriptors. It ensures that proper number of * descriptors will be dequeued in callback @@ -3532,6 +3524,14 @@ throughput_intr_lcore_dec(void *arg) rte_atomic_store_explicit(&tp->burst_sz, num_to_enq, rte_memory_order_relaxed); + enq = 0; + do { + enq += rte_bbdev_enqueue_dec_ops(tp->dev_id, + queue_id, &ops[enqueued], + num_to_enq); + } while (unlikely(num_to_enq != enq)); + enqueued += enq; + /* Wait until processing of previous batch is * completed */ @@ -3603,14 +3603,6 @@ throughput_intr_lcore_enc(void *arg) if (unlikely(num_to_process - enqueued < num_to_enq)) num_to_enq = num_to_process - enqueued; - enq = 0; - do { - enq += rte_bbdev_enqueue_enc_ops(tp->dev_id, - queue_id, &ops[enqueued], - num_to_enq); - } while (unlikely(enq != num_to_enq)); - enqueued += enq; - /* Write to thread burst_sz current number of enqueued * descriptors. It ensures that proper number of * descriptors will be dequeued in callback @@ -3621,6 +3613,14 @@ throughput_intr_lcore_enc(void *arg) rte_atomic_store_explicit(&tp->burst_sz, num_to_enq, rte_memory_order_relaxed); + enq = 0; + do { + enq += rte_bbdev_enqueue_enc_ops(tp->dev_id, + queue_id, &ops[enqueued], +
[PATCH v2 9/9] test/bbdev: remove unnecessary line
Remove unnecesary line of code. No functional impact. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- app/test-bbdev/test_bbdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c index cf224dca5d04..0bbce6ca923b 100644 --- a/app/test-bbdev/test_bbdev.c +++ b/app/test-bbdev/test_bbdev.c @@ -1239,7 +1239,6 @@ test_bbdev_invalid_driver(void) TEST_ASSERT_SUCCESS(rte_bbdev_callback_unregister(dev_id, RTE_BBDEV_EVENT_UNKNOWN, event_callback, NULL), "Failed to unregister RTE_BBDEV_EVENT_ERROR "); - dev2->dev_ops = dev1.dev_ops; /* Tests for rte_bbdev_stats_reset */ dev2->dev_ops = NULL; -- 2.37.1
Re: [PATCH] doc/design: minor cleanus
22/06/2024 16:47, Stephen Hemminger: > Minor fixes to previous edit: > 1. remove blank line at end of file, causes git complaint > 2. fix minor typo (UTF-8?) > 3. break long lines, although rst doesn't care it is nicer > for future editors to keep to 100 characters or less. While changing lines, please split logically after dots, commas, etc, so each line talks about something different. It is easier to read/review, and it makes future changes even easier to review.
Re: [PATCH v7 1/4] dts: update params and parser docstrings
Reviewed-by: Luca Vizzarro
RE: [PATCH] app/testpmd: fix help string of BPF load command
> Based on the logic of 'bpf_parse_flags()' and the 'bpf-load' section of > 'testpmd_funcs.rst' document, the 'B' flag in the help string of > bpf-load command should be '-'. > > Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters") > Cc: konstantin.anan...@intel.com > Cc: sta...@dpdk.org > > Signed-off-by: Chaoyong He > Reviewed-by: Long Wu > Reviewed-by: Peng Zhang > --- > app/test-pmd/bpf_cmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c > index 46f6b7d6d2..24d34f983e 100644 > --- a/app/test-pmd/bpf_cmd.c > +++ b/app/test-pmd/bpf_cmd.c > @@ -139,7 +139,7 @@ static cmdline_parse_token_string_t cmd_load_bpf_prm = > cmdline_parse_inst_t cmd_operate_bpf_ld_parse = { > .f = cmd_operate_bpf_ld_parsed, > .data = NULL, > - .help_str = "bpf-load rx|tx", > + .help_str = "bpf-load rx|tx", > .tokens = { > (void *)&cmd_load_bpf_start, > (void *)&cmd_load_bpf_dir, > -- Acked-by: Konstantin Ananyev > 2.39.1 >
Re: [PATCH 0/5] OpenSSL PMD Optimisations
Series-acked-by: Kai Ji From: Jack Bond-Preston Sent: 03 June 2024 17:01 Cc: dev@dpdk.org Subject: [PATCH 0/5] OpenSSL PMD Optimisations The current implementation of the OpenSSL PMD has numerous performance issues. These revolve around certain operations being performed on a per buffer/packet basis, when they in fact could be performed less often - usually just during initialisation. [1/5]: fix GCM and CCM thread unsafe ctxs = Fixes a concurrency bug affecting AES-GCM and AES-CCM ciphers. This fix is implemented in the same naive (and inefficient) way as existing fixes for other ciphers, and is optimised later in [3/5]. [2/5]: only init 3DES-CTR key + impl once === Fixes an inefficient usage of the OpenSSL API for 3DES-CTR. [5/5]: only set cipher padding once = Fixes an inefficient usage of the OpenSSL API when disabling padding for ciphers. This behaviour was introduced in commit 6b283a03216e ("crypto/openssl: fix extra bytes written at end of data"), which fixes a bug - however, the EVP_CIPHER_CTX_set_padding() call was placed in a suboptimal location. This patch fixes this, preventing the padding being disabled for the cipher twice per buffer (with the second essentially being a wasteful no-op). [3/5] and [4/5]: per-queue-pair context clones == [3/5] and [4/5] aim to fix the key issue that was identified with the performance of the OpenSSL PMD - cloning of OpenSSL CTX structures on a per-buffer basis. This behaviour was introduced in 2019: > commit 67ab783b5d70aed77d9ee3f3ae4688a70c42a49a > Author: Thierry Herbelot > Date: Wed Sep 11 18:06:01 2019 +0200 > > crypto/openssl: use local copy for session contexts > > Session contexts are used for temporary storage when processing a > packet. > If packets for the same session are to be processed simultaneously on > multiple cores, separate contexts must be used. > > Note: with openssl 1.1.1 EVP_CIPHER_CTX can no longer be defined as a > variable on the stack: it must be allocated. This in turn reduces the > performance. Indeed, OpenSSL contexts (both cipher and authentication) cannot safely be used from multiple threads simultaneously, so this patch is required for correctness (assuming the need to support using the same openssl_session across multiple lcores). The downside here is that, as the commit message notes, this does reduce performance quite significantly. It is worth noting that while ciphers were already correctly cloned for cipher ops and auth ops, this behaviour was actually absent for combined ops (AES-GCM and AES-CCM), due to this part of the fix being reverted in 75adf1eae44f ("crypto/openssl: update HMAC routine with 3.0 EVP API"). [1/5] addressed this issue of correctness, and [3/5] implements a more performant fix on top of this. These two patches aim to remedy the performance loss caused by the introduction of cipher context cloning. An approach of maintaining an array of pointers, inside the OpenSSL session structure, to per-queue-pair clones of the OpenSSL CTXs is used. Consequently, there is no need to perform cloning of the context for every buffer - whilst keeping the guarantee that one context is not being used on multiple lcores simultaneously. The cloning of the main context into the array's per-qp context entries is performed lazily/as-needed. There are some trade-offs/judgement calls that were made: - The first call for a queue pair for an op from a given openssl_session will be roughly equivalent to an op from the existing implementation. However, all subsequent calls for the same openssl_session on the same queue pair will not incur this extra work. Thus, whilst the first op on a session on a queue pair will be slower than subsequent ones, this slower first op is still equivalent to *every* op without these patches. The alternative would be pre-populating this array when the openssl_session is initialised, but this would waste memory and processing time if not all queue pairs end up doing work from this openssl_session. - Each pointer inside the array of per-queue-pair pointers has not been cache aligned, because updates only occur on the first buffer per-queue-pair per-session, making the impact of false sharing negligible compared to the extra memory usage of the alignment. [3/5] implements this approach for cipher contexts (EVP_CIPHER_CTX), and [4/5] for authentication contexts (EVP_MD_CTX, EVP_MAC_CTX, etc.). Compared to before, this approach comes with a drawback of extra memory usage - the cause of which is twofold: - The openssl_session struct has grown to accommodate the array, with a length equal to the number of qps in use multiplied by 2 (to allow auth and cipher contexts), per openssl_session structure. openssl_pmd_sym_session_get_size
Re: [PATCH v4 13/13] eal: provide option to use compiler memcpy instead of RTE
On Mon, Jun 24, 2024 at 12:05:53PM +0200, Thomas Monjalon wrote: > 20/06/2024 19:57, Mattias Rönnblom: > > Provide build option to have functions in delegate to > > the standard compiler/libc memcpy(), instead of using the various > > custom DPDK, handcrafted, per-architecture rte_memcpy() > > implementations. > > > > A new meson build option 'use_cc_memcpy' is added. By default, > > the compiler/libc memcpy() is used. > > > > The performance benefits of the custom DPDK rte_memcpy() > > implementations have been diminishing with every compiler release, and > > with current toolchains the use of a custom memcpy() implementation > > may even be a liability. > > > > This patch leaves an option to stay on the custom DPDK implementations, > > would that prove beneficial for certain applications or architectures. > [...] > > --- a/meson_options.txt > > +++ b/meson_options.txt > > +option('use_cc_memcpy', type: 'boolean', value: true, description: > > + 'Have the functions of delegate to compiler/libc > > memcpy() instead of using custom implementation.') > > I suppose you propose this change for 24.11? > I would prefer getting the option disabled in 24.07, > so we can run tests during months before enabling it by default. I think I would suggest having it included and enabled by default in 24.07, but that is too risky perhaps. Having it included in 24.07 and disabled by default would be the conservative option. > This period would also help to make sure it is compiling in all cases. > Please could you enable the option in our compilation scripts? > > I'll give it a try.
[PATCH v6 1/3] dts: updated testpmd shell class
Ported over the promisc and verbose mode functions from v2 of the queue start/stop suite to use for the VLAN suite. Tweaked some of the verification methods to be more concise, changed some docstrings to be more specific. Signed-off-by: Dean Marx --- dts/framework/remote_session/testpmd_shell.py | 260 ++ 1 file changed, 260 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index cb2ab6bd00..89c9435c17 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -225,6 +225,266 @@ def set_forward_mode(self, mode: TestPmdForwardingModes, verify: bool = True): f"Test pmd failed to set fwd mode to {mode.value}" ) +def vlan_filter_set_on(self, port: int, verify: bool = True): +"""Set vlan filter on. + +Args: +port: The port number to use, should be within 0-32. +verify: If :data:`True`, the output of the command is scanned to verify that +vlan filtering was enabled successfully. If not, it is +considered an error. + +Raises: +InteractiveCommandExecutionError: If `verify` is :data:`True` and the filter +fails to update. +""" +filter_cmd_output = self.send_command(f"vlan set filter on {port}") +if verify: +if "Invalid port" in filter_cmd_output or "filter on" not in self.send_command(f"show port info {port}"): +self._logger.debug(f"Failed to enable vlan filter on port {port}: \n{filter_cmd_output}") +raise InteractiveCommandExecutionError(f"Testpmd failed to enable vlan filter on port {port}.") + +def vlan_filter_set_off(self, port: int, verify: bool = True): +"""Set vlan filter off. + +Args: +port: The port number to use, should be within 0-32. +verify: If :data:`True`, the output of the command is scanned to verify that +vlan filtering was disabled successfully. If not, it is +considered an error. + +Raises: +InteractiveCommandExecutionError: If `verify` is :data:`True` and the filter +fails to update. +""" +filter_cmd_output = self.send_command(f"vlan set filter off {port}") +if verify: +if "Invalid port" in filter_cmd_output or "filter off" not in self.send_command(f"show port info {port}"): +self._logger.debug(f"Failed to disable vlan filter on port {port}: \n{filter_cmd_output}") +raise InteractiveCommandExecutionError(f"Testpmd failed to disable vlan filter on port {port}.") + +def rx_vlan_add(self, vlan: int, port: int, verify: bool = True): +"""Add specified vlan tag to the filter list on a port. + +Args: +vlan: The vlan tag to add, should be within 1-1005, 1-4094 extended. +port: The port number to add the tag on, should be within 0-32. +verify: If :data:`True`, the output of the command is scanned to verify that +the vlan tag was added to the filter list on the specified port. If not, it is +considered an error. + +Raises: +InteractiveCommandExecutionError: If `verify` is :data:`True` and the tag +is not added. +""" +vlan_add_output = self.send_command(f"rx_vlan add {vlan} {port}") +if verify: +if "VLAN-filtering disabled" in vlan_add_output or "Invalid vlan_id" in vlan_add_output: +self._logger.debug(f"Failed to add vlan tag {vlan} on port {port}: \n{vlan_add_output}") +raise InteractiveCommandExecutionError(f"Testpmd failed to add vlan tag {vlan} on port {port}.") + +def rx_vlan_rm(self, vlan: int, port: int, verify: bool = True): +"""Remove specified vlan tag from filter list on a port. + +Args: +vlan: The vlan tag to remove, should be within 1-4094. +port: The port number to remove the tag from, should be within 0-32. +verify: If :data:`True`, the output of the command is scanned to verify that +the vlan tag was removed from the filter list on the specified port. If not, it is +considered an error. + +Raises: +InteractiveCommandExecutionError: If `verify` is :data:`True` and the tag +is not removed. +""" +vlan_rm_output = self.send_command(f"rx_vlan rm {vlan} {port}") +if verify: +if "VLAN-filtering disabled" in vlan_rm_output or "Invalid vlan_id" in vlan_rm_output: +self._logger.debug(f"Failed to remove vlan tag {vlan} on port {port}: \n{vlan_rm_output}") +raise InteractiveCommandExecutionError(f"Testpmd failed to remove vlan tag {vlan} on port {port}.") + +def vlan_strip_
[PATCH v6 2/3] dts: refactored VLAN test suite
Tweaked logic on sending and verifying packets for more concise code, added verbose and promisc function calls from pmd shell module. Signed-off-by: Dean Marx --- dts/tests/TestSuite_vlan.py | 167 1 file changed, 167 insertions(+) create mode 100644 dts/tests/TestSuite_vlan.py diff --git a/dts/tests/TestSuite_vlan.py b/dts/tests/TestSuite_vlan.py new file mode 100644 index 00..24406d065d --- /dev/null +++ b/dts/tests/TestSuite_vlan.py @@ -0,0 +1,167 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 University of New Hampshire + +"""Test the support of VLAN Offload Features by Poll Mode Drivers. + +The test suite ensures that with the correct configuration, a port +will not drop a VLAN tagged packet. In order for this to be successful, +packet header stripping and packet receipts must be enabled on the Poll Mode Driver. +The test suite checks that when these conditions are met, the packet is received without issue. +The suite also checks to ensure that when these conditions are not met, as in the cases where +stripping is disabled, or VLAN packet receipts are disabled, the packet is not received. +Additionally, it checks the case where VLAN header insertion is enabled in transmitted packets, +which should be successful if the previous cases pass. + +""" + +from scapy.layers.l2 import Dot1Q, Ether # type: ignore[import] +from scapy.packet import Raw # type: ignore[import] + +from framework.remote_session.testpmd_shell import TestPmdForwardingModes, TestPmdShell +from framework.test_suite import TestSuite + + +class TestVlan(TestSuite): +"""DPDK VLAN test suite. + +Ensures VLAN packet reception on the Poll Mode Driver when certain conditions are met. +If one or more of these conditions are not met, the packet reception should be unsuccessful. +""" + +def set_up_suite(self) -> None: +"""Set up the test suite. + +Setup: +Create a testpmd session and set up tg nodes +verify that at least two ports are open for session +""" +self.verify(len(self._port_links) > 1, "Not enough ports") + +def send_vlan_packet_and_verify( +self, should_receive: bool = True, strip: bool = False, vlan_id: int = -1 +) -> None: +"""Generate a vlan packet, send and verify on the dut. + +Args: +should_receive: indicate whether the packet should be successfully received +vlan_id: expected vlan ID +strip: indicates whether stripping is on or off, +and when the vlan tag is checked for a match +""" +packet = Ether() / Dot1Q(vlan=vlan_id) / Raw(load='x') +received_packets = self.send_packet_and_capture(packet) +test_packet = None +for packet in received_packets: +if b'x' in packet.load: +test_packet = packet +break +if should_receive: +self.verify( +test_packet is not None, "Packet was dropped when it should have been received" +) +if strip: +self.verify(Dot1Q not in test_packet, "Vlan tag was not stripped successfully") +else: +self.verify( +test_packet.vlan == vlan_id, "The received tag did not match the expected tag" +) +else: +self.verify( +test_packet is None, +"Packet was received when it should have been dropped", +) + +def send_packet_and_verify_insertion(self, expected_id: int = -1) -> None: +"""Generate a packet with no vlan tag, send and verify on the dut. + +Args: +expected_id: the vlan id that is being inserted through tx_offload configuration +should_receive: indicate whether the packet should be successfully received +""" +packet = Ether() / Raw(load='x') +received_packets = self.send_packet_and_capture(packet) +test_packet = None +for packet in received_packets: +if b'x' in packet.load: +test_packet = packet +break +self.verify( +test_packet is not None, "Packet was dropped when it should have been received" +) +self.verify(Dot1Q in test_packet, "The received packet did not have a vlan tag") +self.verify(test_packet.vlan == expected_id, "The received tag did not match the expected tag") + +def test_vlan_receipt_no_stripping(self) -> None: +"""Ensure vlan packet is dropped when receipts are enabled and header stripping is disabled. + +Test: +Create an interactive testpmd shell and verify a vlan packet. +""" +testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) +testpmd.set_forward_mode(TestPmdForwardingModes.mac) +testpmd
[PATCH v6 3/3] dts: config schema
Configuration to run vlan test suite Signed-off-by: Dean Marx --- dts/framework/config/conf_yaml_schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index 4731f4511d..eca8244f27 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -187,7 +187,8 @@ "enum": [ "hello_world", "os_udp", -"pmd_buffer_scatter" +"pmd_buffer_scatter", +"vlan" ] }, "test_target": { -- 2.44.0
Re: [PATCH] net/mlx5: fix memleak for resource object
On 06/24, Dariusz Sosnowski wrote: > Hi, > > Thank you very much for the fix. > > Could you please provide the commit message explaining the problem reported > by Coverity and the fix? I thought of doing that, but found Coverity report already explained it, so i was afraid it could be redundant, but I'll add it as a quick explanation > > > -Original Message- > > From: Mahmoud Maatuq > > Sent: Sunday, June 23, 2024 12:36 > > To: Dariusz Sosnowski ; Slava Ovsiienko > > ; Bing Zhao ; Ori Kam > > ; Suanming Mou ; Matan Azrad > > > > Cc: dev@dpdk.org; Mahmoud Maatuq > > Subject: [PATCH] net/mlx5: fix memleak for resource object > > > > Coverity issue: 426424 > > Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list utility") > > The issue was introduced in commit 27d171b88031 ("net/mlx5: abstract flow > action and enable reconfigure"). > Fixes tag should reference that commit. how to get the proper commit that introduced the issue, as I used git blame to get the above mentioned commit > > > Cc: ma...@nvidia.com > > > > Signed-off-by: Mahmoud Maatuq > > --- > > drivers/net/mlx5/mlx5_flow_dv.c | 5 - > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > > b/drivers/net/mlx5/mlx5_flow_dv.c > > index d46beffd4c..1010b8e423 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void > > *cb_ctx) > > items = *((const struct rte_flow_item **)(ctx->data2)); > > resource->matcher_object = mlx5dr_bwc_matcher_create > > (resource->group->tbl, resource->priority, > > items); > > - if (!(resource->matcher_object)) > > + if (!(resource->matcher_object)) { > > While we're at it, could you please remove the parentheses around > resource->matcher_object? They're redundant. > > > + mlx5_free(resource); > > return NULL; > > + } > > #else > > + mlx5_free(resource); > > return NULL; > > #endif > > } > > -- > > 2.43.0 > > Best regards, > Dariusz Sosnowski >
[PATCH v2] net/mlx5: fix memleak for resource object
this makes sure that the allocated resource object is freed for all branches that return NULL Coverity issue: 426424 Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure") Cc: mkash...@nvidia.com Signed-off-by: Mahmoud Maatuq --- drivers/net/mlx5/mlx5_flow_dv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index d46beffd4c..8a0d58cb05 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void *cb_ctx) items = *((const struct rte_flow_item **)(ctx->data2)); resource->matcher_object = mlx5dr_bwc_matcher_create (resource->group->tbl, resource->priority, items); - if (!(resource->matcher_object)) + if (!resource->matcher_object) { + mlx5_free(resource); return NULL; + } #else + mlx5_free(resource); return NULL; #endif } -- 2.43.0
[PATCH v2] app/graph: fix destination buffer too small
as sizeof(config.rx.mempool_name) is < sizeof(res->mempool) we should copy at most sizeof(config.rx.mempool_name) and replace memcpy with strlcpy as mempool name is a null terminated string Coverity issue: 415430 Fixes: 3850cb06ab9c ("app/graph: add ethdev commands") Cc: sk...@marvell.com Signed-off-by: Mahmoud Maatuq --- v2: * replaced memcpy with strlcpy --- app/graph/ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c index cfc1b18569..e7a02b40a9 100644 --- a/app/graph/ethdev.c +++ b/app/graph/ethdev.c @@ -16,6 +16,7 @@ #include "ethdev_priv.h" #include "module_api.h" +#include "rte_string_fns.h" static const char cmd_ethdev_mtu_help[] = "ethdev mtu "; @@ -671,7 +672,7 @@ cmd_ethdev_parsed(void *parsed_result, __rte_unused struct cmdline *cl, void *da memset(&config, 0, sizeof(struct ethdev_config)); config.rx.n_queues = res->nb_rxq; config.rx.queue_size = ETHDEV_RX_DESC_DEFAULT; - memcpy(config.rx.mempool_name, res->mempool, strlen(res->mempool)); + strlcpy(config.rx.mempool_name, res->mempool, sizeof(config.rx.mempool_name)); config.tx.n_queues = res->nb_txq; config.tx.queue_size = ETHDEV_TX_DESC_DEFAULT; -- 2.43.0