DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: dev@dpdk.org
Cc: huawei.xie@intel.com, Thomas Monjalon <thomas.monjalon@6wind.com>,
	Ksiadz MarcinX <marcinx.ksiadz@intel.com>,
	Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [dpdk-dev] [PATCH 3/4] examples/vhost: remove unnessary settings for TX offload
Date: Fri, 25 Mar 2016 14:01:33 +0800	[thread overview]
Message-ID: <1458885694-31111-4-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1458885694-31111-1-git-send-email-yuanhan.liu@linux.intel.com>

We now got all required settings to make TSO work at vhost lib.
We also don't need to calculate the pseudo header checksum just
for the checksum offloading case, as the TCP/IP stack would have
done that.

So, those settings are not necessary; remove them.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 examples/vhost/main.c | 58 ---------------------------------------------------
 1 file changed, 58 deletions(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index a45cddb..ae1e110 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -51,9 +51,6 @@
 #include <rte_malloc.h>
 #include <rte_virtio_net.h>
 #include <rte_ip.h>
-#include <rte_tcp.h>
-#include <rte_udp.h>
-#include <rte_sctp.h>
 
 #include "main.h"
 
@@ -1147,58 +1144,6 @@ find_local_dest(struct virtio_net *dev, struct rte_mbuf *m,
 	return 0;
 }
 
-static uint16_t
-get_psd_sum(void *l3_hdr, uint64_t ol_flags)
-{
-	if (ol_flags & PKT_TX_IPV4)
-		return rte_ipv4_phdr_cksum(l3_hdr, ol_flags);
-	else /* assume ethertype == ETHER_TYPE_IPv6 */
-		return rte_ipv6_phdr_cksum(l3_hdr, ol_flags);
-}
-
-static void virtio_tx_offload(struct rte_mbuf *m)
-{
-	void *l3_hdr;
-	struct ipv4_hdr *ipv4_hdr = NULL;
-	struct tcp_hdr *tcp_hdr = NULL;
-	struct udp_hdr *udp_hdr = NULL;
-	struct sctp_hdr *sctp_hdr = NULL;
-	struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
-
-	l3_hdr = (char *)eth_hdr + m->l2_len;
-
-	if (m->tso_segsz != 0) {
-		ipv4_hdr = (struct ipv4_hdr *)l3_hdr;
-		tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len);
-		m->ol_flags |= PKT_TX_IP_CKSUM;
-		ipv4_hdr->hdr_checksum = 0;
-		tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags);
-		return;
-	}
-
-	if (m->ol_flags & PKT_TX_L4_MASK) {
-		switch (m->ol_flags & PKT_TX_L4_MASK) {
-		case PKT_TX_TCP_CKSUM:
-			tcp_hdr = (struct tcp_hdr *)
-					((char *)l3_hdr + m->l3_len);
-			tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags);
-			break;
-		case PKT_TX_UDP_CKSUM:
-			udp_hdr = (struct udp_hdr *)
-					((char *)l3_hdr + m->l3_len);
-			udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, m->ol_flags);
-			break;
-		case PKT_TX_SCTP_CKSUM:
-			sctp_hdr = (struct sctp_hdr *)
-					((char *)l3_hdr + m->l3_len);
-			sctp_hdr->cksum = 0;
-			break;
-		default:
-			break;
-		}
-	}
-}
-
 /*
  * This function routes the TX packet to the correct interface. This may be a local device
  * or the physical port.
@@ -1265,9 +1210,6 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag)
 		m->vlan_tci = vlan_tag;
 	}
 
-	if ((m->ol_flags & PKT_TX_L4_MASK) || (m->ol_flags & PKT_TX_TCP_SEG))
-		virtio_tx_offload(m);
-
 	tx_q->m_table[len] = m;
 	len++;
 	if (enable_stats) {
-- 
1.9.0

  parent reply	other threads:[~2016-03-25  5:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25  6:01 [dpdk-dev] [PATCH 0/4] vhost vlan tag and TSO fixes/cleanups Yuanhan Liu
2016-03-25  6:01 ` [dpdk-dev] [PATCH 1/4] vhost: remove unnecessary return Yuanhan Liu
2016-03-25  6:01 ` [dpdk-dev] [PATCH 2/4] vhost: complete TSO settings Yuanhan Liu
2016-03-25  7:13   ` Yuanhan Liu
2016-03-25  6:01 ` Yuanhan Liu [this message]
2016-03-25  6:01 ` [dpdk-dev] [PATCH 4/4] examples/vhost: fix wrong vlan_tag Yuanhan Liu
2016-03-25  7:58 ` [dpdk-dev] [PATCH v2 0/4] vhost vlan tag and TSO fixes/cleanups Yuanhan Liu
2016-03-25  7:58   ` [dpdk-dev] [PATCH v2 1/4] vhost: remove unnecessary return Yuanhan Liu
2016-03-25  7:58   ` [dpdk-dev] [PATCH v2 2/4] examples/vhost: remove unnecessary pseudo checksum calc Yuanhan Liu
2016-03-25  7:58   ` [dpdk-dev] [PATCH v2 3/4] examples/vhost: fix offload settings Yuanhan Liu
2016-03-25  7:58   ` [dpdk-dev] [PATCH v2 4/4] examples/vhost: fix wrong vlan_tag Yuanhan Liu
2016-03-25 18:45   ` [dpdk-dev] [PATCH v2 0/4] vhost vlan tag and TSO fixes/cleanups Thomas Monjalon

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=1458885694-31111-4-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=marcinx.ksiadz@intel.com \
    --cc=thomas.monjalon@6wind.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).