DPDK patches and discussions
 help / color / mirror / Atom feed
From: miroslaw.walukiewicz@intel.com
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/3] pmd: add new header containing TCP offload specific definitions
Date: Mon, 13 Oct 2014 10:38:40 -0400	[thread overview]
Message-ID: <20141013143840.19211.79771.stgit@gklab-18-011.igk.intel.com> (raw)
In-Reply-To: <20141013143834.19211.44077.stgit@gklab-18-011.igk.intel.com>

From: Miroslaw Walukiewicz <miroslaw.walukiewicz@intel.com>

The function for computing initial TCP header checksum.
The file is common for both i40e and ixgbe PMD drivers

Signed-off-by: Mirek Walukiewicz <miroslaw.walukiewicz@intel.com>
---
 lib/librte_net/Makefile      |    3 +
 lib/librte_net/rte_tcp_off.h |  122 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/rte_tcp_off.h

diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index ad2e482..83e76d1 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -34,7 +34,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
 
 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_sctp.h rte_icmp.h rte_arp.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_sctp.h rte_icmp.h rte_arp.h \
+rte_tcp_off.h
 
 
 include $(RTE_SDK)/mk/rte.install.mk
diff --git a/lib/librte_net/rte_tcp_off.h b/lib/librte_net/rte_tcp_off.h
new file mode 100644
index 0000000..6143396
--- /dev/null
+++ b/lib/librte_net/rte_tcp_off.h
@@ -0,0 +1,122 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *      @(#)in.h        8.3 (Berkeley) 1/3/94
+ * $FreeBSD: src/sys/netinet/in.h,v 1.82 2003/10/25 09:37:10 ume Exp $
+ */
+
+#ifndef _RTE_TCP_OFF_H_
+#define _RTE_TCP_OFF_H_
+
+/**
+ * @file
+ *
+ * TCP offload -related defines
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * function computes the TCP pseudo checksum for TSO
+ * it is a commnon function for i40e/ixgbe drivers
+ * it computes the IP header initial checksum as input 
+ * for computing TCP data checksum made by HW 
+ */
+static inline u_short
+rte_in_pseudo(uint32_t src_ipv4, uint32_t dst_ipv4, uint32_t proto)
+{
+	uint64_t sum;
+	union l_val {
+		uint16_t s[2];
+		uint32_t l;
+	} l_val;
+	union q_val {
+		uint16_t s[4];
+		uint32_t l[2];
+		uint64_t q;
+	} q_val;
+
+	sum = (uint64_t) src_ipv4 + dst_ipv4 + proto;
+
+	q_val.q = sum;	
+	l_val.l = q_val.s[0] + q_val.s[1] + q_val.s[2] + q_val.s[3];
+	sum = l_val.s[0] + l_val.s[1];
+
+	sum > 65535 ? sum -= 65535 : sum;
+
+	return (sum);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _RTE_TCP_OFF_H_ */

  reply	other threads:[~2014-10-13 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 14:38 [dpdk-dev] [PATCH 1/3] pmd: add new flag to indicate TX TSO operation on the packet miroslaw.walukiewicz
2014-10-13 14:38 ` miroslaw.walukiewicz [this message]
2014-10-14  9:50   ` [dpdk-dev] [PATCH 2/3] pmd: add new header containing TCP offload specific definitions Thomas Monjalon
2014-10-13 14:38 ` [dpdk-dev] [PATCH 3/3] pmd i40e: Enable Transmit Segmentation Offload for TCP traffic miroslaw.walukiewicz
2014-10-14  7:47 ` [dpdk-dev] [PATCH 1/3] pmd: add new flag to indicate TX TSO operation on the packet Liu, Jijiang

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=20141013143840.19211.79771.stgit@gklab-18-011.igk.intel.com \
    --to=miroslaw.walukiewicz@intel.com \
    --cc=dev@dpdk.org \
    /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).