From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 701A447CD for ; Fri, 25 Mar 2016 06:59:04 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 24 Mar 2016 22:59:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,388,1455004800"; d="scan'208";a="675375666" Received: from yliu-dev.sh.intel.com ([10.239.66.49]) by FMSMGA003.fm.intel.com with ESMTP; 24 Mar 2016 22:59:02 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: huawei.xie@intel.com, Thomas Monjalon , Ksiadz MarcinX , Yuanhan Liu Date: Fri, 25 Mar 2016 14:01:33 +0800 Message-Id: <1458885694-31111-4-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1458885694-31111-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1458885694-31111-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH 3/4] examples/vhost: remove unnessary settings for TX offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2016 05:59:05 -0000 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 --- 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 #include #include -#include -#include -#include #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