summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorYuanhan Liu <yuanhan.liu@linux.intel.com>2016-03-25 15:58:50 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-03-25 19:53:00 +0100
commit5674dad222d62130ae3ba59fe818caaa4843957c (patch)
tree6abfc5823a3b16e11b392ad014d4ff1b196b50cd /examples
parentcce3ce3567e9b4a1809243179c942730e5707e8b (diff)
downloaddpdk-5674dad222d62130ae3ba59fe818caaa4843957c.zip
dpdk-5674dad222d62130ae3ba59fe818caaa4843957c.tar.gz
dpdk-5674dad222d62130ae3ba59fe818caaa4843957c.tar.xz
examples/vhost: remove unnecessary pseudo checksum calculation
For checksum offloading only case, the TCP/IP stack would have calculated the pseudo checksum. Therefore, we don't need to re-calculate it again here; remove it. Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/vhost/main.c41
1 files changed, 6 insertions, 35 deletions
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index a45cddb..ceabbce 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -52,8 +52,6 @@
#include <rte_virtio_net.h>
#include <rte_ip.h>
#include <rte_tcp.h>
-#include <rte_udp.h>
-#include <rte_sctp.h>
#include "main.h"
@@ -1161,42 +1159,15 @@ 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;
- }
- }
+ 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);
}
/*
@@ -1265,7 +1236,7 @@ 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))
+ if (m->ol_flags & PKT_TX_TCP_SEG)
virtio_tx_offload(m);
tx_q->m_table[len] = m;