From: Jiawei Zhu <17826875952@163.com>
To: dev@dpdk.org
Cc: zhujiawei12@huawei.com, matan@nvidia.com, shahafs@nvidia.com,
viacheslavo@nvidia.com
Subject: [dpdk-dev] [PATCH] net/mlx5: add Rx checksum offload flag return bad
Date: Mon, 22 Mar 2021 11:46:06 -0400 [thread overview]
Message-ID: <1616427966-3481-1-git-send-email-17826875952@163.com> (raw)
From: Jiawei Zhu <zhujiawei12@huawei.com>
When open the rx checksum offload and receive the wrong checksum,
add the ol_flags return bad. And it's not best to use multiplication
and division here.
Signed-off-by: Jiawei Zhu <zhujiawei12@huawei.com>
---
drivers/net/mlx5/mlx5_rxtx.c | 17 ++++++++++-------
drivers/net/mlx5/mlx5_utils.h | 6 ------
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index e3ce9fd..9233af8 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1325,13 +1325,16 @@ enum mlx5_txcmp_code {
uint32_t ol_flags = 0;
uint16_t flags = rte_be_to_cpu_16(cqe->hdr_type_etc);
- ol_flags =
- TRANSPOSE(flags,
- MLX5_CQE_RX_L3_HDR_VALID,
- PKT_RX_IP_CKSUM_GOOD) |
- TRANSPOSE(flags,
- MLX5_CQE_RX_L4_HDR_VALID,
- PKT_RX_L4_CKSUM_GOOD);
+ if (flags & MLX5_CQE_RX_L3_HDR_VALID)
+ ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+ else
+ ol_flags |= PKT_RX_IP_CKSUM_BAD;
+
+ if (flags & MLX5_CQE_RX_L4_HDR_VALID)
+ ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+ else
+ ol_flags |= PKT_RX_IP_CKSUM_BAD;
+
return ol_flags;
}
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index 7a62187..2f71a23 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -44,12 +44,6 @@
#define NB_SEGS(m) ((m)->nb_segs)
#define PORT(m) ((m)->port)
-/* Transpose flags. Useful to convert IBV to DPDK flags. */
-#define TRANSPOSE(val, from, to) \
- (((from) >= (to)) ? \
- (((val) & (from)) / ((from) / (to))) : \
- (((val) & (from)) * ((to) / (from))))
-
/*
* For the case which data is linked with sequence increased index, the
* array table will be more efficiect than hash table once need to serarch
--
1.8.3.1
next reply other threads:[~2021-03-22 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 15:46 Jiawei Zhu [this message]
2021-03-22 16:26 ` Jiawei Zhu
2021-03-23 16:33 ` Slava Ovsiienko
2021-03-24 16:22 ` Jiawei Zhu
2021-03-25 11:55 ` Slava Ovsiienko
2021-03-28 13:39 ` Jiawei Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1616427966-3481-1-git-send-email-17826875952@163.com \
--to=17826875952@163.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=shahafs@nvidia.com \
--cc=viacheslavo@nvidia.com \
--cc=zhujiawei12@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).