if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
if [ -z "$DPDK_VER" ]; then
- DPDK_VER="18.11.5"
+ DPDK_VER="19.11"
fi
install_dpdk $DPDK_VER
# Enable pdump support in OVS.
In addition to the requirements described in :doc:`general`, building Open
vSwitch with DPDK will require the following:
-- DPDK 18.11.5
+- DPDK 19.11
- A `DPDK supported NIC`_
#. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``::
$ cd /usr/src/
- $ wget http://fast.dpdk.org/rel/dpdk-18.11.5.tar.xz
- $ tar xf dpdk-18.11.5.tar.xz
- $ export DPDK_DIR=/usr/src/dpdk-stable-18.11.5
+ $ wget https://fast.dpdk.org/rel/dpdk-19.11.tar.xz
+ $ tar xf dpdk-19.11.tar.xz
+ $ export DPDK_DIR=/usr/src/dpdk-19.11
$ cd $DPDK_DIR
#. (Optional) Configure DPDK as a shared library
release notes`_.
.. _DPDK release notes:
- https://doc.dpdk.org/guides/rel_notes/release_18_11.html
+ https://doc.dpdk.org/guides-19.11/rel_notes/release_19_11.html
- Upper bound MTU: DPDK device drivers differ in how the L2 frame for a
given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in
directory in DPDK, ``make`` the application and run like so::
$ sudo ./build/app/dpdk-pdump -- \
- --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap \
- --server-socket-path=/usr/local/var/run/openvswitch
+ --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap
The above command captures traffic received on queue 0 of port 0 and stores it
in ``/tmp/pkts.pcap``. Other combinations of port numbers, queues numbers and
packets that traverse port 0 in a single pcap file::
$ sudo ./build/app/dpdk-pdump -- \
- --pdump 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap' \
- --server-socket-path=/usr/local/var/run/openvswitch
+ --pdump 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap'
-``server-socket-path`` must be set to the value of ``ovs_rundir()`` which
-typically resolves to ``/usr/local/var/run/openvswitch``.
+.. note::
+
+ ``XDG_RUNTIME_DIR`` environment variable might need to be adjusted to
+ OVS runtime directory (``/var/run/openvswitch`` in most cases) for
+ ``dpdk-pdump`` utility if OVS started by non-root user.
Many tools are available to view the contents of the pcap file. Once example is
tcpdump. Issue the following command to view the contents of ``pkts.pcap``::
to be an example of this behavior; check the driver documentation if this
is suspected.
-For more information please refer to the `DPDK Port Hotplug Framework`__.
+Hotplugging with IGB_UIO
+~~~~~~~~~~~~~~~~~~~~~~~~
-__ http://dpdk.org/doc/guides/prog_guide/port_hotplug_framework.html#hotplug
+As of DPDK 19.11, default igb_uio hotplugging behavior changes from
+previous DPDK versions.
+
+With DPDK 19.11, if no device is bound to igb_uio when OVS is launched then
+the IOVA mode may be set to virtual addressing for DPDK. This is incompatible
+for hotplugging with igb_uio.
+
+To hotplug a port with igb_uio in this case, DPDK must be configured to use
+physical addressing for IOVA mode. For more information regarding IOVA modes
+in DPDK please refer to the `DPDK IOVA Mode Detection`__.
+
+__ https://doc.dpdk.org/guides-19.11/prog_guide/env_abstraction_layer.html#iova-mode-detection
+
+To configure OVS DPDK to use physical addressing for IOVA::
+
+ $ ovs-vsctl --no-wait set Open_vSwitch . \
+ other_config:dpdk-extra="--iova-mode=pa"
+
+.. note::
+
+ Changing IOVA mode requires restarting the ovs-vswitchd application.
.. _representors:
For more information, refer to the `DPDK documentation`__.
-__ https://doc.dpdk.org/guides-18.11/prog_guide/switch_representation.html
+__ https://doc.dpdk.org/guides-19.11/prog_guide/switch_representation.html
Prior to port representors there was a one-to-one relationship between the PF
and the eth device. With port representors the relationship becomes one PF to
guests
.. _DPDK documentation:
- https://doc.dpdk.org/guides-18.11/prog_guide/ring_lib.html
+ https://doc.dpdk.org/guides-19.11/prog_guide/ring_lib.html
DPDK sources to VM and build DPDK::
$ cd /root/dpdk/
- $ wget http://fast.dpdk.org/rel/dpdk-18.11.5.tar.xz
- $ tar xf dpdk-18.11.5.tar.xz
- $ export DPDK_DIR=/root/dpdk/dpdk-stable-18.11.5
+ $ wget https://fast.dpdk.org/rel/dpdk-19.11.tar.xz
+ $ tar xf dpdk-19.11.tar.xz
+ $ export DPDK_DIR=/root/dpdk/dpdk-19.11
$ export DPDK_TARGET=x86_64-native-linuxapp-gcc
$ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
$ cd $DPDK_DIR
Further information can be found in the
`DPDK documentation
-<https://doc.dpdk.org/guides-18.11/prog_guide/vhost_lib.html>`__
+<https://doc.dpdk.org/guides-19.11/prog_guide/vhost_lib.html>`__
Moreover you need to have root privileges to load the required modules and to bind
the NIC to the DPDK-compatible driver.
-.. _DPDK supported NIC: http://dpdk.org/doc/nics
+.. _DPDK supported NIC: https://core.dpdk.org/supported/#nics
All tests are skipped if no hugepages are configured. User must look into the DPDK
manual to figure out how to `Configure hugepages`_.
The phy test will skip if no compatible physical device is available.
-.. _Configure hugepages: http://doc.dpdk.org/guides/linux_gsg/sys_reqs.html
+.. _Configure hugepages: https://doc.dpdk.org/guides-19.11/linux_gsg/sys_reqs.html
All the features documented under `Unit Tests`_ are available for the DPDK
datapath testsuite.
* DPDK pdump support is deprecated and will be removed in next releases.
* DPDK ring ports (dpdkr) are deprecated and will be removed in next
releases.
- * OVS validated with DPDK 18.11.5, due to the inclusion of a fix for
- CVE-2019-14818, this DPDK version is strongly recommended to be used.
+ * Add support for DPDK 19.11.
v2.12.0 - 03 Sep 2019
---------------------
noinst_HEADERS += \
include/sparse/rte_byteorder.h \
- include/sparse/rte_esp.h \
- include/sparse/rte_icmp.h \
- include/sparse/rte_ip.h \
- include/sparse/rte_sctp.h \
- include/sparse/rte_tcp.h \
- include/sparse/rte_udp.h \
include/sparse/xmmintrin.h \
include/sparse/arpa/inet.h \
include/sparse/bits/floatn.h \
+++ /dev/null
-/*-
- * BSD LICENSE
- *
- * Copyright (c) 2016-2017, Mellanox Technologies. 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.
- */
-
-#ifndef __CHECKER__
-#error "Use this header only with sparse. It is not a correct implementation."
-#endif
-
-#ifndef _RTE_ESP_H_
-#define _RTE_ESP_H_
-
-/**
- * @file
- *
- * ESP-related defines
- */
-
-#include "openvswitch/types.h"
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * ESP Header
- */
-struct esp_hdr {
- ovs_be32 spi; /**< Security Parameters Index */
- ovs_be32 seq; /**< packet sequence number */
-} __attribute__((__packed__));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RTE_ESP_H_ */
+++ /dev/null
-/* BSD LICENSE
- *
- * Copyright(c) 2013 6WIND.
- *
- * 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 6WIND S.A. 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 __CHECKER__
-#error "Use this header only with sparse. It is not a correct implementation."
-#endif
-
-#ifndef _RTE_ICMP_H_
-#define _RTE_ICMP_H_
-
-/**
- * @file
- *
- * ICMP-related defines
- */
-
-#include "openvswitch/types.h"
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * ICMP Header
- */
-struct icmp_hdr {
- uint8_t icmp_type; /* ICMP packet type. */
- uint8_t icmp_code; /* ICMP packet code. */
- ovs_be16 icmp_cksum; /* ICMP packet checksum. */
- ovs_be16 icmp_ident; /* ICMP packet identifier. */
- ovs_be16 icmp_seq_nb; /* ICMP packet sequence number. */
-} __attribute__((__packed__));
-
-/* ICMP packet types */
-#define IP_ICMP_ECHO_REPLY 0
-#define IP_ICMP_ECHO_REQUEST 8
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RTE_ICMP_H_ */
+++ /dev/null
-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- * Copyright 2014 6WIND S.A.
- * 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_IP_H_
-#define _RTE_IP_H_
-
-/**
- * @file
- *
- * IP-related defines
- */
-
-#include <stdint.h>
-#include <netinet/in.h>
-
-#include <rte_byteorder.h>
-#include <rte_mbuf.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * IPv4 Header
- */
-struct ipv4_hdr {
- uint8_t version_ihl; /**< version and header length */
- uint8_t type_of_service; /**< type of service */
- ovs_be16 total_length; /**< length of packet */
- ovs_be16 packet_id; /**< packet ID */
- ovs_be16 fragment_offset; /**< fragmentation offset */
- uint8_t time_to_live; /**< time to live */
- uint8_t next_proto_id; /**< protocol ID */
- ovs_be16 hdr_checksum; /**< header checksum */
- ovs_be32 src_addr; /**< source address */
- ovs_be32 dst_addr; /**< destination address */
-} __attribute__((__packed__));
-
-/** Create IPv4 address */
-#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \
- (((b) & 0xff) << 16) | \
- (((c) & 0xff) << 8) | \
- ((d) & 0xff))
-
-/** Maximal IPv4 packet length (including a header) */
-#define IPV4_MAX_PKT_LEN 65535
-
-/** Internet header length mask for version_ihl field */
-#define IPV4_HDR_IHL_MASK (0x0f)
-/**
- * Internet header length field multiplier (IHL field specifies overall header
- * length in number of 4-byte words)
- */
-#define IPV4_IHL_MULTIPLIER (4)
-
-/* Fragment Offset * Flags. */
-#define IPV4_HDR_DF_SHIFT 14
-#define IPV4_HDR_MF_SHIFT 13
-#define IPV4_HDR_FO_SHIFT 3
-
-#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT)
-#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT)
-
-#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1)
-
-#define IPV4_HDR_OFFSET_UNITS 8
-
-/*
- * IPv4 address types
- */
-#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */
-#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */
-#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */
-#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */
-#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */
-#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */
-
-/*
- * IPv4 Multicast-related macros
- */
-#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */
-#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */
-
-#define IS_IPV4_MCAST(x) \
- ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */
-
-/**
- * @internal Calculate a sum of all words in the buffer.
- * Helper routine for the rte_raw_cksum().
- *
- * @param buf
- * Pointer to the buffer.
- * @param len
- * Length of the buffer.
- * @param sum
- * Initial value of the sum.
- * @return
- * sum += Sum of all words in the buffer.
- */
-static inline uint32_t
-__rte_raw_cksum(const void *buf, size_t len, uint32_t sum)
-{
- /* workaround gcc strict-aliasing warning */
- uintptr_t ptr = (uintptr_t)buf;
- typedef uint16_t __attribute__((__may_alias__)) u16_p;
- const u16_p *u16 = (const u16_p *)ptr;
-
- while (len >= (sizeof(*u16) * 4)) {
- sum += u16[0];
- sum += u16[1];
- sum += u16[2];
- sum += u16[3];
- len -= sizeof(*u16) * 4;
- u16 += 4;
- }
- while (len >= sizeof(*u16)) {
- sum += *u16;
- len -= sizeof(*u16);
- u16 += 1;
- }
-
- /* if length is in odd bytes */
- if (len == 1)
- sum += *((const uint8_t *)u16);
-
- return sum;
-}
-
-/**
- * @internal Reduce a sum to the non-complemented checksum.
- * Helper routine for the rte_raw_cksum().
- *
- * @param sum
- * Value of the sum.
- * @return
- * The non-complemented checksum.
- */
-static inline uint16_t
-__rte_raw_cksum_reduce(uint32_t sum)
-{
- sum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);
- sum = ((sum & 0xffff0000) >> 16) + (sum & 0xffff);
- return (uint16_t)sum;
-}
-
-/**
- * Process the non-complemented checksum of a buffer.
- *
- * @param buf
- * Pointer to the buffer.
- * @param len
- * Length of the buffer.
- * @return
- * The non-complemented checksum.
- */
-static inline uint16_t
-rte_raw_cksum(const void *buf, size_t len)
-{
- uint32_t sum;
-
- sum = __rte_raw_cksum(buf, len, 0);
- return __rte_raw_cksum_reduce(sum);
-}
-
-/**
- * Compute the raw (non complemented) checksum of a packet.
- *
- * @param m
- * The pointer to the mbuf.
- * @param off
- * The offset in bytes to start the checksum.
- * @param len
- * The length in bytes of the data to checksum.
- * @param cksum
- * A pointer to the checksum, filled on success.
- * @return
- * 0 on success, -1 on error (bad length or offset).
- */
-static inline int
-rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
- uint16_t *cksum)
-{
- const struct rte_mbuf *seg;
- const char *buf;
- uint32_t sum, tmp;
- uint32_t seglen, done;
-
- /* easy case: all data in the first segment */
- if (off + len <= rte_pktmbuf_data_len(m)) {
- *cksum = rte_raw_cksum(rte_pktmbuf_mtod_offset(m,
- const char *, off), len);
- return 0;
- }
-
- if (unlikely(off + len > rte_pktmbuf_pkt_len(m)))
- return -1; /* invalid params, return a dummy value */
-
- /* else browse the segment to find offset */
- seglen = 0;
- for (seg = m; seg != NULL; seg = seg->next) {
- seglen = rte_pktmbuf_data_len(seg);
- if (off < seglen)
- break;
- off -= seglen;
- }
- seglen -= off;
- buf = rte_pktmbuf_mtod_offset(seg, const char *, off);
- if (seglen >= len) {
- /* all in one segment */
- *cksum = rte_raw_cksum(buf, len);
- return 0;
- }
-
- /* hard case: process checksum of several segments */
- sum = 0;
- done = 0;
- for (;;) {
- tmp = __rte_raw_cksum(buf, seglen, 0);
- if (done & 1)
- tmp = rte_bswap16(tmp);
- sum += tmp;
- done += seglen;
- if (done == len)
- break;
- seg = seg->next;
- buf = rte_pktmbuf_mtod(seg, const char *);
- seglen = rte_pktmbuf_data_len(seg);
- if (seglen > len - done)
- seglen = len - done;
- }
-
- *cksum = __rte_raw_cksum_reduce(sum);
- return 0;
-}
-
-/**
- * Process the IPv4 checksum of an IPv4 header.
- *
- * The checksum field must be set to 0 by the caller.
- *
- * @param ipv4_hdr
- * The pointer to the contiguous IPv4 header.
- * @return
- * The complemented checksum to set in the IP packet.
- */
-static inline uint16_t
-rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)
-{
- uint16_t cksum;
- cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr));
- return (cksum == 0xffff) ? cksum : ~cksum;
-}
-
-/**
- * Process the pseudo-header checksum of an IPv4 header.
- *
- * The checksum field must be set to 0 by the caller.
- *
- * Depending on the ol_flags, the pseudo-header checksum expected by the
- * drivers is not the same. For instance, when TSO is enabled, the IP
- * payload length must not be included in the packet.
- *
- * When ol_flags is 0, it computes the standard pseudo-header checksum.
- *
- * @param ipv4_hdr
- * The pointer to the contiguous IPv4 header.
- * @param ol_flags
- * The ol_flags of the associated mbuf.
- * @return
- * The non-complemented checksum to set in the L4 header.
- */
-static inline uint16_t
-rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
-{
- struct ipv4_psd_header {
- ovs_be32 src_addr; /* IP address of source host. */
- ovs_be32 dst_addr; /* IP address of destination host. */
- uint8_t zero; /* zero. */
- uint8_t proto; /* L4 protocol type. */
- uint16_t len; /* L4 length. */
- } psd_hdr;
-
- psd_hdr.src_addr = ipv4_hdr->src_addr;
- psd_hdr.dst_addr = ipv4_hdr->dst_addr;
- psd_hdr.zero = 0;
- psd_hdr.proto = ipv4_hdr->next_proto_id;
- if (ol_flags & PKT_TX_TCP_SEG) {
- psd_hdr.len = 0;
- } else {
- psd_hdr.len = rte_cpu_to_be_16(
- (uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length)
- - sizeof(struct ipv4_hdr)));
- }
- return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
-}
-
-/**
- * Process the IPv4 UDP or TCP checksum.
- *
- * The IPv4 header should not contains options. The IP and layer 4
- * checksum must be set to 0 in the packet by the caller.
- *
- * @param ipv4_hdr
- * The pointer to the contiguous IPv4 header.
- * @param l4_hdr
- * The pointer to the beginning of the L4 header.
- * @return
- * The complemented checksum to set in the IP packet.
- */
-static inline uint16_t
-rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
-{
- uint32_t cksum;
- uint32_t l4_len;
-
- l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
- sizeof(struct ipv4_hdr);
-
- cksum = rte_raw_cksum(l4_hdr, l4_len);
- cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);
-
- cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
- cksum = (~cksum) & 0xffff;
- if (cksum == 0)
- cksum = 0xffff;
-
- return cksum;
-}
-
-/**
- * IPv6 Header
- */
-struct ipv6_hdr {
- ovs_be32 vtc_flow; /**< IP version, traffic class & flow label. */
- ovs_be16 payload_len; /**< IP packet length - includes sizeof(ip_header). */
- uint8_t proto; /**< Protocol, next header. */
- uint8_t hop_limits; /**< Hop limits. */
- uint8_t src_addr[16]; /**< IP address of source host. */
- uint8_t dst_addr[16]; /**< IP address of destination host(s). */
-} __attribute__((__packed__));
-
-/* IPv6 vtc_flow: IPv / TC / flow_label */
-#define IPV6_HDR_FL_SHIFT 0
-#define IPV6_HDR_TC_SHIFT 20
-#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1)
-#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT)
-
-/**
- * Process the pseudo-header checksum of an IPv6 header.
- *
- * Depending on the ol_flags, the pseudo-header checksum expected by the
- * drivers is not the same. For instance, when TSO is enabled, the IPv6
- * payload length must not be included in the packet.
- *
- * When ol_flags is 0, it computes the standard pseudo-header checksum.
- *
- * @param ipv6_hdr
- * The pointer to the contiguous IPv6 header.
- * @param ol_flags
- * The ol_flags of the associated mbuf.
- * @return
- * The non-complemented checksum to set in the L4 header.
- */
-static inline uint16_t
-rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
-{
- uint32_t sum;
- struct {
- ovs_be32 len; /* L4 length. */
- ovs_be32 proto; /* L4 protocol - top 3 bytes must be zero */
- } psd_hdr;
-
- psd_hdr.proto = (ipv6_hdr->proto << 24);
- if (ol_flags & PKT_TX_TCP_SEG) {
- psd_hdr.len = 0;
- } else {
- psd_hdr.len = ipv6_hdr->payload_len;
- }
-
- sum = __rte_raw_cksum(ipv6_hdr->src_addr,
- sizeof(ipv6_hdr->src_addr) + sizeof(ipv6_hdr->dst_addr),
- 0);
- sum = __rte_raw_cksum(&psd_hdr, sizeof(psd_hdr), sum);
- return __rte_raw_cksum_reduce(sum);
-}
-
-/**
- * Process the IPv6 UDP or TCP checksum.
- *
- * The IPv4 header should not contains options. The layer 4 checksum
- * must be set to 0 in the packet by the caller.
- *
- * @param ipv6_hdr
- * The pointer to the contiguous IPv6 header.
- * @param l4_hdr
- * The pointer to the beginning of the L4 header.
- * @return
- * The complemented checksum to set in the IP packet.
- */
-static inline uint16_t
-rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)
-{
- uint32_t cksum;
- uint32_t l4_len;
-
- l4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len);
-
- cksum = rte_raw_cksum(l4_hdr, l4_len);
- cksum += rte_ipv6_phdr_cksum(ipv6_hdr, 0);
-
- cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
- cksum = (~cksum) & 0xffff;
- if (cksum == 0)
- cksum = 0xffff;
-
- return cksum;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RTE_IP_H_ */
+++ /dev/null
-/*-
- * 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 $
- */
-
-/**
- * @file
- *
- * SCTP-related defines
- */
-
-#ifndef __CHECKER__
-#error "Use this header only with sparse. It is not a correct implementation."
-#endif
-
-#ifndef _RTE_SCTP_H_
-#define _RTE_SCTP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * SCTP Header
- */
-struct sctp_hdr {
- ovs_be16 src_port; /**< Source port. */
- ovs_be16 dst_port; /**< Destin port. */
- ovs_be32 tag; /**< Validation tag. */
- ovs_be32 cksum; /**< Checksum. */
-} __attribute__((__packed__));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RTE_SCTP_H_ */
+++ /dev/null
-/*-
- * 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 __CHECKER__
-#error "Use this header only with sparse. It is not a correct implementation."
-#endif
-
-#ifndef _RTE_TCP_H_
-#define _RTE_TCP_H_
-
-/**
- * @file
- *
- * TCP-related defines
- */
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * TCP Header
- */
-struct tcp_hdr {
- ovs_be16 src_port; /**< TCP source port. */
- ovs_be16 dst_port; /**< TCP destination port. */
- ovs_be32 sent_seq; /**< TX data sequence number. */
- ovs_be32 recv_ack; /**< RX data acknowledgement sequence number. */
- uint8_t data_off; /**< Data offset. */
- uint8_t tcp_flags; /**< TCP flags */
- ovs_be16 rx_win; /**< RX flow control window. */
- ovs_be16 cksum; /**< TCP checksum. */
- ovs_be16 tcp_urp; /**< TCP urgent pointer, if any. */
-} __attribute__((__packed__));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RTE_TCP_H_ */
+++ /dev/null
-/*-
- * 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 __CHECKER__
-#error "Use this header only with sparse. It is not a correct implementation."
-#endif
-
-#ifndef _RTE_UDP_H_
-#define _RTE_UDP_H_
-
-/**
- * @file
- *
- * UDP-related defines
- */
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * UDP Header
- */
-struct udp_hdr {
- ovs_be16 src_port; /**< UDP source port. */
- ovs_be16 dst_port; /**< UDP destination port. */
- ovs_be16 dgram_len; /**< UDP datagram length */
- ovs_be16 dgram_cksum; /**< UDP datagram checksum */
-} __attribute__((__packed__));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RTE_UDP_H_ */
#include <rte_memzone.h>
#include <rte_version.h>
#ifdef DPDK_PDUMP
-#include <rte_mempool.h>
#include <rte_pdump.h>
#endif
RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID;
#ifdef DPDK_PDUMP
- VLOG_INFO("DPDK pdump packet capture enabled");
VLOG_WARN("DPDK pdump support is deprecated and "
"will be removed in next OVS releases.");
- err = rte_pdump_init(ovs_rundir());
+ err = rte_pdump_init();
if (err) {
VLOG_INFO("Error initialising DPDK pdump");
- rte_pdump_uninit();
- } else {
- char *server_socket_path;
-
- server_socket_path = xasprintf("%s/%s", ovs_rundir(),
- "pdump_server_socket");
- fatal_signal_add_file_to_unlink(server_socket_path);
- free(server_socket_path);
}
#endif
* The minimum mbuf size is limited to avoid scatter behaviour and drop in
* performance for standard Ethernet MTU.
*/
-#define ETHER_HDR_MAX_LEN (ETHER_HDR_LEN + ETHER_CRC_LEN \
+#define ETHER_HDR_MAX_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN \
+ (2 * VLAN_HEADER_LEN))
-#define MTU_TO_FRAME_LEN(mtu) ((mtu) + ETHER_HDR_LEN + ETHER_CRC_LEN)
+#define MTU_TO_FRAME_LEN(mtu) ((mtu) + RTE_ETHER_HDR_LEN + \
+ RTE_ETHER_CRC_LEN)
#define MTU_TO_MAX_FRAME_LEN(mtu) ((mtu) + ETHER_HDR_MAX_LEN)
#define FRAME_LEN_TO_MTU(frame_len) ((frame_len) \
- - ETHER_HDR_LEN - ETHER_CRC_LEN)
+ - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN)
#define NETDEV_DPDK_MBUF_ALIGN 1024
#define NETDEV_DPDK_MAX_PKT_LEN 9728
* can change dynamically at runtime. For now, use this rough
* heurisitic.
*/
- if (mtu >= ETHER_MTU) {
+ if (mtu >= RTE_ETHER_MTU) {
n_mbufs = MAX_NB_MBUF;
} else {
n_mbufs = MIN_NB_MBUF;
* scatter to support jumbo RX.
* Setting scatter for the device is done after checking for
* scatter support in the device capabilites. */
- if (dev->mtu > ETHER_MTU) {
+ if (dev->mtu > RTE_ETHER_MTU) {
if (dev->hw_ol_features & NETDEV_RX_HW_SCATTER) {
conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
}
{
struct rte_pktmbuf_pool_private *mbp_priv;
struct rte_eth_dev_info info;
- struct ether_addr eth_addr;
+ struct rte_ether_addr eth_addr;
int diag;
int n_rxq, n_txq;
uint32_t rx_chksm_offload_capa = DEV_RX_OFFLOAD_UDP_CKSUM |
dev->port_id = port_no;
dev->type = type;
dev->flags = 0;
- dev->requested_mtu = ETHER_MTU;
+ dev->requested_mtu = RTE_ETHER_MTU;
dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
dev->requested_lsc_interrupt_mode = 0;
ovsrcu_index_init(&dev->vid, -1);
}
RTE_ETH_FOREACH_DEV (port_id) {
- struct ether_addr ea;
+ struct rte_ether_addr ea;
rte_eth_macaddr_get(port_id, &ea);
memcpy(port_mac.ea, ea.addr_bytes, ETH_ADDR_LEN);
struct rte_meter_srtcm_profile *profile,
struct rte_mbuf *pkt, uint64_t time)
{
- uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr);
+ uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct rte_ether_hdr);
return rte_meter_srtcm_color_blind_check(meter, profile, time, pkt_len) ==
- e_RTE_METER_GREEN;
+ RTE_COLOR_GREEN;
}
static int
* a method to retrieve the upper bound MTU for a given device.
*/
if (MTU_TO_MAX_FRAME_LEN(mtu) > NETDEV_DPDK_MAX_PKT_LEN
- || mtu < ETHER_MIN_MTU) {
+ || mtu < RTE_ETHER_MIN_MTU) {
VLOG_WARN("%s: unsupported MTU %d\n", dev->up.name, mtu);
return EINVAL;
}