From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>
Subject: [dpdk-dev] [PATCH] net/enic: use TSO flags
Date: Wed, 10 Jan 2018 01:17:11 -0800 [thread overview]
Message-ID: <20180110091712.32198-11-johndale@cisco.com> (raw)
In-Reply-To: <20180110091712.32198-1-johndale@cisco.com>
Depend on the tx_offload flags in the mbuf to determeine the length
of the headers instead of looking into the packet itself.
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
---
drivers/net/enic/enic_rxtx.c | 56 ++------------------------------------------
1 file changed, 2 insertions(+), 54 deletions(-)
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index b9358d34f..08d600ffb 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -105,59 +105,6 @@ enic_cq_rx_desc_n_bytes(struct cq_desc *cqd)
CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
}
-/* Find the offset to L5. This is needed by enic TSO implementation.
- * Return 0 if not a TCP packet or can't figure out the length.
- */
-static inline uint8_t tso_header_len(struct rte_mbuf *mbuf)
-{
- struct ether_hdr *eh;
- struct vlan_hdr *vh;
- struct ipv4_hdr *ip4;
- struct ipv6_hdr *ip6;
- struct tcp_hdr *th;
- uint8_t hdr_len;
- uint16_t ether_type;
-
- /* offset past Ethernet header */
- eh = rte_pktmbuf_mtod(mbuf, struct ether_hdr *);
- ether_type = eh->ether_type;
- hdr_len = sizeof(struct ether_hdr);
- if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
- vh = rte_pktmbuf_mtod_offset(mbuf, struct vlan_hdr *, hdr_len);
- ether_type = vh->eth_proto;
- hdr_len += sizeof(struct vlan_hdr);
- }
-
- /* offset past IP header */
- switch (rte_be_to_cpu_16(ether_type)) {
- case ETHER_TYPE_IPv4:
- ip4 = rte_pktmbuf_mtod_offset(mbuf, struct ipv4_hdr *, hdr_len);
- if (ip4->next_proto_id != IPPROTO_TCP)
- return 0;
- hdr_len += (ip4->version_ihl & 0xf) * 4;
- break;
- case ETHER_TYPE_IPv6:
- ip6 = rte_pktmbuf_mtod_offset(mbuf, struct ipv6_hdr *, hdr_len);
- if (ip6->proto != IPPROTO_TCP)
- return 0;
- hdr_len += sizeof(struct ipv6_hdr);
- break;
- default:
- return 0;
- }
-
- if ((hdr_len + sizeof(struct tcp_hdr)) > mbuf->pkt_len)
- return 0;
-
- /* offset past TCP header */
- th = rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, hdr_len);
- hdr_len += (th->data_off >> 4) * 4;
-
- if (hdr_len > mbuf->pkt_len)
- return 0;
-
- return hdr_len;
-}
static inline uint8_t
enic_cq_rx_check_err(struct cq_desc *cqd)
@@ -556,7 +503,8 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
header_len = 0;
if (tso) {
- header_len = tso_header_len(tx_pkt);
+ header_len = tx_pkt->l2_len + tx_pkt->l3_len +
+ tx_pkt->l4_len;
/* Drop if non-TCP packet or TSO seg size is too big */
if (unlikely(header_len == 0 || ((tx_pkt->tso_segsz +
--
2.12.0
next prev parent reply other threads:[~2018-01-10 9:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 9:17 [dpdk-dev] [PATCH] maintainers: update for enic John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] doc: minor updates to the enic guide John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: use the new ethdev offloads API John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: fix L4 Rx ptype comparison John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: do not set checksum unkonwn offload flag John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: remove remaining header-split code John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: remove a couple unnecessary statements John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: refill only the address of the RQ descriptor John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: use dynamic log types John Daley
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: use BSD-3-Clause John Daley
2018-01-10 9:17 ` John Daley [this message]
2018-01-10 9:17 ` [dpdk-dev] [PATCH] net/enic: remove a conditional from the Tx path John Daley
2018-01-11 13:32 ` [dpdk-dev] [PATCH] maintainers: update for enic Ferruh Yigit
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=20180110091712.32198-11-johndale@cisco.com \
--to=johndale@cisco.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@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).