get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1280/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1280,
    "url": "https://patches.dpdk.org/api/patches/1280/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1415984609-2484-10-git-send-email-olivier.matz@6wind.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1415984609-2484-10-git-send-email-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1415984609-2484-10-git-send-email-olivier.matz@6wind.com",
    "date": "2014-11-14T17:03:25",
    "name": "[dpdk-dev,v2,09/13] mbuf: introduce new checksum API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "eb5659ad36a7f131513229bbc7aed4b5fa98e8f4",
    "submitter": {
        "id": 8,
        "url": "https://patches.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1415984609-2484-10-git-send-email-olivier.matz@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1280/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1280/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id CB4F07FE9;\n\tFri, 14 Nov 2014 17:54:09 +0100 (CET)",
            "from mail-wi0-f171.google.com (mail-wi0-f171.google.com\n\t[209.85.212.171]) by dpdk.org (Postfix) with ESMTP id CEAC97F89\n\tfor <dev@dpdk.org>; Fri, 14 Nov 2014 17:53:56 +0100 (CET)",
            "by mail-wi0-f171.google.com with SMTP id r20so29645wiv.16\n\tfor <dev@dpdk.org>; Fri, 14 Nov 2014 09:04:00 -0800 (PST)",
            "from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.\n\t[82.239.227.177]) by mx.google.com with ESMTPSA id\n\tcu9sm40352554wjb.0.2014.11.14.09.03.59 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 14 Nov 2014 09:04:00 -0800 (PST)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=+r27St0C0RaCPZ0QMQ0Jq9gKFDrgD70mMkd0Ht0BscE=;\n\tb=d7ymk6JSznaLmqeZG57DLDePHr8kzrrSF1DfpxFiaQp0l+UlKNr9u8iL1Fy9BLLBKb\n\tvT9VUHh2sOkYoZvrOhni28oAb3Cms65+At5PTLu5dsomPhrugY/mGjOTHwNxuiCkgEhZ\n\tSggHj5OlTqa8mlRVCc83etqhT+CcccuUF6o7euGCwMbYHBWNJvtT3Pe1N17R+UlLDEQm\n\tmWMtASyNvnQUhS9c4OV0LWM/f7Z1FfmafLhrw+mc7cyIUfgXLN7+ExWmx2ZXdEMFl+J6\n\tzpl6jbDV5F5ArNndIAQDU+Tij0uqHEbvdyHhXBe7tuPJdO2rBMqM+JlCTPpYIqlOgar/\n\tjbnw==",
        "X-Gm-Message-State": "ALoCoQn/z1CiC5bLgPQafVVK7fER+ZZFIJp3kAdaQzlwyU8yPSwoTqp3U1pvLjaw9kW/8OqhoSrD",
        "X-Received": "by 10.194.71.6 with SMTP id q6mr15581958wju.98.1415984640671;\n\tFri, 14 Nov 2014 09:04:00 -0800 (PST)",
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 14 Nov 2014 18:03:25 +0100",
        "Message-Id": "<1415984609-2484-10-git-send-email-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.1.0",
        "In-Reply-To": "<1415984609-2484-1-git-send-email-olivier.matz@6wind.com>",
        "References": "<1415635166-1364-1-git-send-email-olivier.matz@6wind.com>\n\t<1415984609-2484-1-git-send-email-olivier.matz@6wind.com>",
        "Cc": "jigsaw@gmail.com",
        "Subject": "[dpdk-dev] [PATCH v2 09/13] mbuf: introduce new checksum API",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Introduce new functions to calculate checksums. These new functions\nare derivated from the ones provided csumonly.c but slightly reworked.\nThere is still some room for future optimization of these functions\n(maybe SSE/AVX, ...).\n\nThis API will be modified in tbe next commits by the introduction of\nTSO that requires a different pseudo header checksum to be set in the\npacket.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n app/test-pmd/csumonly.c    | 133 ++-------------------------------\n lib/librte_mbuf/rte_mbuf.h |   3 +-\n lib/librte_net/rte_ip.h    | 179 +++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 189 insertions(+), 126 deletions(-)",
    "diff": "diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex dda5d9e..39f974d 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -86,137 +86,22 @@\n #define _htons(x) (x)\n #endif\n \n-static inline uint16_t\n-get_16b_sum(uint16_t *ptr16, uint32_t nr)\n-{\n-\tuint32_t sum = 0;\n-\twhile (nr > 1)\n-\t{\n-\t\tsum +=*ptr16;\n-\t\tnr -= sizeof(uint16_t);\n-\t\tptr16++;\n-\t\tif (sum > UINT16_MAX)\n-\t\t\tsum -= UINT16_MAX;\n-\t}\n-\n-\t/* If length is in odd bytes */\n-\tif (nr)\n-\t\tsum += *((uint8_t*)ptr16);\n-\n-\tsum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);\n-\tsum &= 0x0ffff;\n-\treturn (uint16_t)sum;\n-}\n-\n-static inline uint16_t\n-get_ipv4_cksum(struct ipv4_hdr *ipv4_hdr)\n-{\n-\tuint16_t cksum;\n-\tcksum = get_16b_sum((uint16_t*)ipv4_hdr, sizeof(struct ipv4_hdr));\n-\treturn (uint16_t)((cksum == 0xffff)?cksum:~cksum);\n-}\n-\n-\n-static inline uint16_t\n-get_ipv4_psd_sum(struct ipv4_hdr *ip_hdr)\n-{\n-\t/* Pseudo Header for IPv4/UDP/TCP checksum */\n-\tunion ipv4_psd_header {\n-\t\tstruct {\n-\t\t\tuint32_t src_addr; /* IP address of source host. */\n-\t\t\tuint32_t dst_addr; /* IP address of destination host(s). */\n-\t\t\tuint8_t  zero;     /* zero. */\n-\t\t\tuint8_t  proto;    /* L4 protocol type. */\n-\t\t\tuint16_t len;      /* L4 length. */\n-\t\t} __attribute__((__packed__));\n-\t\tuint16_t u16_arr[0];\n-\t} psd_hdr;\n-\n-\tpsd_hdr.src_addr = ip_hdr->src_addr;\n-\tpsd_hdr.dst_addr = ip_hdr->dst_addr;\n-\tpsd_hdr.zero     = 0;\n-\tpsd_hdr.proto    = ip_hdr->next_proto_id;\n-\tpsd_hdr.len      = rte_cpu_to_be_16((uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length)\n-\t\t\t\t- sizeof(struct ipv4_hdr)));\n-\treturn get_16b_sum(psd_hdr.u16_arr, sizeof(psd_hdr));\n-}\n-\n-static inline uint16_t\n-get_ipv6_psd_sum(struct ipv6_hdr *ip_hdr)\n-{\n-\t/* Pseudo Header for IPv6/UDP/TCP checksum */\n-\tunion ipv6_psd_header {\n-\t\tstruct {\n-\t\t\tuint8_t src_addr[16]; /* IP address of source host. */\n-\t\t\tuint8_t dst_addr[16]; /* IP address of destination host(s). */\n-\t\t\tuint32_t len;         /* L4 length. */\n-\t\t\tuint32_t proto;       /* L4 protocol - top 3 bytes must be zero */\n-\t\t} __attribute__((__packed__));\n-\n-\t\tuint16_t u16_arr[0]; /* allow use as 16-bit values with safe aliasing */\n-\t} psd_hdr;\n-\n-\trte_memcpy(&psd_hdr.src_addr, ip_hdr->src_addr,\n-\t\t\tsizeof(ip_hdr->src_addr) + sizeof(ip_hdr->dst_addr));\n-\tpsd_hdr.len       = ip_hdr->payload_len;\n-\tpsd_hdr.proto     = (ip_hdr->proto << 24);\n-\n-\treturn get_16b_sum(psd_hdr.u16_arr, sizeof(psd_hdr));\n-}\n-\n static uint16_t\n get_psd_sum(void *l3_hdr, uint16_t ethertype)\n {\n \tif (ethertype == _htons(ETHER_TYPE_IPv4))\n-\t\treturn get_ipv4_psd_sum(l3_hdr);\n+\t\treturn rte_ipv4_phdr_cksum(l3_hdr);\n \telse /* assume ethertype == ETHER_TYPE_IPv6 */\n-\t\treturn get_ipv6_psd_sum(l3_hdr);\n-}\n-\n-static inline uint16_t\n-get_ipv4_udptcp_checksum(struct ipv4_hdr *ipv4_hdr, uint16_t *l4_hdr)\n-{\n-\tuint32_t cksum;\n-\tuint32_t l4_len;\n-\n-\tl4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - sizeof(struct ipv4_hdr);\n-\n-\tcksum = get_16b_sum(l4_hdr, l4_len);\n-\tcksum += get_ipv4_psd_sum(ipv4_hdr);\n-\n-\tcksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);\n-\tcksum = (~cksum) & 0xffff;\n-\tif (cksum == 0)\n-\t\tcksum = 0xffff;\n-\treturn (uint16_t)cksum;\n-}\n-\n-static inline uint16_t\n-get_ipv6_udptcp_checksum(struct ipv6_hdr *ipv6_hdr, uint16_t *l4_hdr)\n-{\n-\tuint32_t cksum;\n-\tuint32_t l4_len;\n-\n-\tl4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len);\n-\n-\tcksum = get_16b_sum(l4_hdr, l4_len);\n-\tcksum += get_ipv6_psd_sum(ipv6_hdr);\n-\n-\tcksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);\n-\tcksum = (~cksum) & 0xffff;\n-\tif (cksum == 0)\n-\t\tcksum = 0xffff;\n-\n-\treturn (uint16_t)cksum;\n+\t\treturn rte_ipv6_phdr_cksum(l3_hdr);\n }\n \n static uint16_t\n get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype)\n {\n \tif (ethertype == _htons(ETHER_TYPE_IPv4))\n-\t\treturn get_ipv4_udptcp_checksum(l3_hdr, l4_hdr);\n+\t\treturn rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr);\n \telse /* assume ethertype == ETHER_TYPE_IPv6 */\n-\t\treturn get_ipv6_udptcp_checksum(l3_hdr, l4_hdr);\n+\t\treturn rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);\n }\n \n /*\n@@ -294,7 +179,7 @@ process_inner_cksums(void *l3_hdr, uint16_t ethertype, uint16_t l3_len,\n \t\tif (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)\n \t\t\tol_flags |= PKT_TX_IP_CKSUM;\n \t\telse\n-\t\t\tipv4_hdr->hdr_checksum = get_ipv4_cksum(ipv4_hdr);\n+\t\t\tipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);\n \n \t}\n \telse if (ethertype != _htons(ETHER_TYPE_IPv6))\n@@ -366,7 +251,7 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,\n \t\tipv4_hdr->hdr_checksum = 0;\n \n \t\tif ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) == 0)\n-\t\t\tipv4_hdr->hdr_checksum = get_ipv4_cksum(ipv4_hdr);\n+\t\t\tipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);\n \t}\n \n \tudp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + outer_l3_len);\n@@ -376,12 +261,10 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,\n \t\tif ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) == 0) {\n \t\t\tif (outer_ethertype == _htons(ETHER_TYPE_IPv4))\n \t\t\t\tudp_hdr->dgram_cksum =\n-\t\t\t\t\tget_ipv4_udptcp_checksum(ipv4_hdr,\n-\t\t\t\t\t\t(uint16_t *)udp_hdr);\n+\t\t\t\t\trte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr);\n \t\t\telse\n \t\t\t\tudp_hdr->dgram_cksum =\n-\t\t\t\t\tget_ipv6_udptcp_checksum(ipv6_hdr,\n-\t\t\t\t\t\t(uint16_t *)udp_hdr);\n+\t\t\t\t\trte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr);\n \t\t}\n \t}\n \ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex e76617f..3c8e825 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -114,7 +114,8 @@ extern \"C\" {\n  *  - fill l2_len and l3_len in mbuf\n  *  - set the flags PKT_TX_TCP_CKSUM, PKT_TX_SCTP_CKSUM or PKT_TX_UDP_CKSUM\n  *  - calculate the pseudo header checksum and set it in the L4 header (only\n- *    for TCP or UDP). For SCTP, set the crc field to 0.\n+ *    for TCP or UDP). See rte_ipv4_phdr_cksum() and rte_ipv6_phdr_cksum().\n+ *    For SCTP, set the crc field to 0.\n  */\n #define PKT_TX_L4_NO_CKSUM   (0ULL << 52) /* Disable L4 cksum of TX pkt. */\n #define PKT_TX_TCP_CKSUM     (1ULL << 52) /**< TCP cksum of TX pkt. computed by NIC. */\ndiff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h\nindex e3f65c1..9cfca7f 100644\n--- a/lib/librte_net/rte_ip.h\n+++ b/lib/librte_net/rte_ip.h\n@@ -78,6 +78,9 @@\n \n #include <stdint.h>\n \n+#include <rte_memcpy.h>\n+#include <rte_byteorder.h>\n+\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n@@ -247,6 +250,124 @@ struct ipv4_hdr {\n \t((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */\n \n /**\n+ * Process the non-complemented checksum of a buffer.\n+ *\n+ * @param buf\n+ *   Pointer to the buffer.\n+ * @param len\n+ *   Length of the buffer.\n+ * @return\n+ *   The non-complemented checksum.\n+ */\n+static inline uint16_t\n+rte_raw_cksum(const char *buf, size_t len)\n+{\n+\tconst uint16_t *u16 = (const uint16_t *)buf;\n+\tuint32_t sum = 0;\n+\n+\twhile (len >= 8) {\n+\t\tsum += u16[0]; sum += u16[1]; sum += u16[2]; sum += u16[3];\n+\t\tlen -= 8;\n+\t\tu16 += 4;\n+\t}\n+\twhile (len >= 2) {\n+\t\tsum += *u16;\n+\t\tlen -= 2;\n+\t\tu16 += 1;\n+\t}\n+\n+\t/* if length is in odd bytes */\n+\tif (len == 1)\n+\t\tsum += *((const uint8_t *)u16);\n+\n+\tsum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);\n+\tsum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);\n+\treturn (uint16_t)sum;\n+}\n+\n+/**\n+ * Process the IPv4 checksum of an IPv4 header.\n+ *\n+ * The checksum field must be set to 0 by the caller.\n+ *\n+ * @param ipv4_hdr\n+ *   The pointer to the contiguous IPv4 header.\n+ * @return\n+ *   The complemented checksum to set in the IP packet.\n+ */\n+static inline uint16_t\n+rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)\n+{\n+\tuint16_t cksum;\n+\tcksum = rte_raw_cksum((const char *)ipv4_hdr, sizeof(struct ipv4_hdr));\n+\treturn ((cksum == 0xffff) ? cksum : ~cksum);\n+}\n+\n+/**\n+ * Process the pseudo-header checksum of an IPv4 header.\n+ *\n+ * The checksum field must be set to 0 by the caller.\n+ *\n+ * @param ipv4_hdr\n+ *   The pointer to the contiguous IPv4 header.\n+ * @return\n+ *   The non-complemented checksum to set in the L4 header.\n+ */\n+static inline uint16_t\n+rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr)\n+{\n+\tstruct ipv4_psd_header {\n+\t\tuint32_t src_addr; /* IP address of source host. */\n+\t\tuint32_t dst_addr; /* IP address of destination host. */\n+\t\tuint8_t  zero;     /* zero. */\n+\t\tuint8_t  proto;    /* L4 protocol type. */\n+\t\tuint16_t len;      /* L4 length. */\n+\t} psd_hdr;\n+\n+\tpsd_hdr.src_addr = ipv4_hdr->src_addr;\n+\tpsd_hdr.dst_addr = ipv4_hdr->dst_addr;\n+\tpsd_hdr.zero = 0;\n+\tpsd_hdr.proto = ipv4_hdr->next_proto_id;\n+\tpsd_hdr.len = rte_cpu_to_be_16(\n+\t\t(uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length)\n+\t\t\t- sizeof(struct ipv4_hdr)));\n+\treturn rte_raw_cksum((const char *)&psd_hdr, sizeof(psd_hdr));\n+}\n+\n+/**\n+ * Process the IPv4 UDP or TCP checksum.\n+ *\n+ * The IPv4 header should not contains options. The IP and layer 4\n+ * checksum must be set to 0 in the packet by the caller.\n+ *\n+ * @param ipv4_hdr\n+ *   The pointer to the contiguous IPv4 header.\n+ * @param l4_hdr\n+ *   The pointer to the beginning of the L4 header.\n+ * @return\n+ *   The complemented checksum to set in the IP packet.\n+ */\n+static inline uint16_t\n+rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)\n+{\n+\tuint32_t cksum;\n+\tuint32_t l4_len;\n+\n+\tl4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -\n+\t\tsizeof(struct ipv4_hdr);\n+\n+\tcksum = rte_raw_cksum(l4_hdr, l4_len);\n+\tcksum += rte_ipv4_phdr_cksum(ipv4_hdr);\n+\n+\tcksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);\n+\tcksum = (~cksum) & 0xffff;\n+\tif (cksum == 0)\n+\t\tcksum = 0xffff;\n+\n+\treturn cksum;\n+}\n+\n+/**\n  * IPv6 Header\n  */\n struct ipv6_hdr {\n@@ -258,6 +379,64 @@ struct ipv6_hdr {\n \tuint8_t  dst_addr[16]; /**< IP address of destination host(s). */\n } __attribute__((__packed__));\n \n+/**\n+ * Process the pseudo-header checksum of an IPv6 header.\n+ *\n+ * @param ipv6_hdr\n+ *   The pointer to the contiguous IPv6 header.\n+ * @return\n+ *   The non-complemented checksum to set in the L4 header.\n+ */\n+static inline uint16_t\n+rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr)\n+{\n+\tstruct ipv6_psd_header {\n+\t\tuint8_t src_addr[16]; /* IP address of source host. */\n+\t\tuint8_t dst_addr[16]; /* IP address of destination host. */\n+\t\tuint32_t len;         /* L4 length. */\n+\t\tuint32_t proto;       /* L4 protocol - top 3 bytes must be zero */\n+\t} psd_hdr;\n+\n+\trte_memcpy(&psd_hdr.src_addr, ipv6_hdr->src_addr,\n+\t\tsizeof(ipv6_hdr->src_addr) + sizeof(ipv6_hdr->dst_addr));\n+\tpsd_hdr.proto = (ipv6_hdr->proto << 24);\n+\tpsd_hdr.len = ipv6_hdr->payload_len;\n+\n+\treturn rte_raw_cksum((const char *)&psd_hdr, sizeof(psd_hdr));\n+}\n+\n+/**\n+ * Process the IPv6 UDP or TCP checksum.\n+ *\n+ * The IPv4 header should not contains options. The layer 4 checksum\n+ * must be set to 0 in the packet by the caller.\n+ *\n+ * @param ipv6_hdr\n+ *   The pointer to the contiguous IPv6 header.\n+ * @param l4_hdr\n+ *   The pointer to the beginning of the L4 header.\n+ * @return\n+ *   The complemented checksum to set in the IP packet.\n+ */\n+static inline uint16_t\n+rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)\n+{\n+\tuint32_t cksum;\n+\tuint32_t l4_len;\n+\n+\tl4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len);\n+\n+\tcksum = rte_raw_cksum(l4_hdr, l4_len);\n+\tcksum += rte_ipv6_phdr_cksum(ipv6_hdr, 0);\n+\n+\tcksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);\n+\tcksum = (~cksum) & 0xffff;\n+\tif (cksum == 0)\n+\t\tcksum = 0xffff;\n+\n+\treturn cksum;\n+}\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "09/13"
    ]
}