From: Haiyue Wang <haiyue.wang@intel.com>
To: dev@dpdk.org, qiming.yang@intel.com, qi.z.zhang@intel.com
Cc: ting.xu@intel.com, yinan.wang@intel.com,
Haiyue Wang <haiyue.wang@intel.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH v1] net/ice: optimize TCP header size calculation
Date: Fri, 31 Jul 2020 00:04:30 +0800 [thread overview]
Message-ID: <20200730160430.10609-1-haiyue.wang@intel.com> (raw)
The rte_pktmbuf_read function can handle the contiguous data buffer
reading, so remove the redundant contiguous memory handling.
Fixes: 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx")
Fixes: 2a0c9ae4f646 ("net/ice: fix TCP checksum offload")
Fixes: 7365a3cee51f ("net/ice: calculate TCP header size for offload")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
drivers/net/ice/ice_rxtx.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index bcb67ec25..a35c5546b 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2375,18 +2375,12 @@ ice_calc_pkt_desc(struct rte_mbuf *tx_pkt)
static inline uint16_t
ice_calc_pkt_tcp_hdr(struct rte_mbuf *tx_pkt, union ice_tx_offload tx_offload)
{
- uint16_t tcpoff = tx_offload.l2_len + tx_offload.l3_len;
const struct rte_tcp_hdr *tcp_hdr;
- struct rte_tcp_hdr _tcp_hdr;
+ struct rte_tcp_hdr tcp_hdr_buf;
- if (tcpoff + sizeof(struct rte_tcp_hdr) < tx_pkt->data_len) {
- tcp_hdr = rte_pktmbuf_mtod_offset(tx_pkt, struct rte_tcp_hdr *,
- tcpoff);
-
- return (tcp_hdr->data_off & 0xf0) >> 2;
- }
-
- tcp_hdr = rte_pktmbuf_read(tx_pkt, tcpoff, sizeof(_tcp_hdr), &_tcp_hdr);
+ tcp_hdr = rte_pktmbuf_read(tx_pkt,
+ tx_offload.l2_len + tx_offload.l3_len,
+ sizeof(tcp_hdr_buf), &tcp_hdr_buf);
if (tcp_hdr)
return (tcp_hdr->data_off & 0xf0) >> 2;
else
--
2.28.0
reply other threads:[~2020-07-30 16:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200730160430.10609-1-haiyue.wang@intel.com \
--to=haiyue.wang@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
--cc=ting.xu@intel.com \
--cc=yinan.wang@intel.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).