diff options
author | Ed Warnicke <eaw@cisco.com> | 2015-12-08 15:45:58 -0700 |
---|---|---|
committer | Ed Warnicke <eaw@cisco.com> | 2015-12-08 15:47:27 -0700 |
commit | cb9cadad578297ffd78fa8a33670bdf1ab669e7e (patch) | |
tree | 6ac2be912482cc7849a26f0ab845561c3d7f4e26 /dpdk | |
parent | fb0815d4ae4bb0fe27bd9313f34b45c8593b907e (diff) |
Initial commit of vpp code.v1.0.0
Change-Id: Ib246f1fbfce93274020ee93ce461e3d8bd8b9f17
Signed-off-by: Ed Warnicke <eaw@cisco.com>
Diffstat (limited to 'dpdk')
10 files changed, 654 insertions, 0 deletions
diff --git a/dpdk/Makefile b/dpdk/Makefile new file mode 100644 index 00000000000..c33cf63ccf5 --- /dev/null +++ b/dpdk/Makefile @@ -0,0 +1,174 @@ +# Copyright (c) 2015 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Scripts require non-POSIX parts of bash +SHELL := /bin/bash + +DPDK_BUILD_DIR ?= $(CURDIR)/_build +DPDK_INSTALL_DIR ?= $(CURDIR)/_install +DPDK_PKTMBUF_HEADROOM ?= 256 +DPDK_DOWNLOAD_DIR ?= $(HOME)/Downloads +DPDK_MARCH ?= native +DPDK_DEBUG ?= n + +B := $(DPDK_BUILD_DIR) +I := $(DPDK_INSTALL_DIR) +DPDK_VERSION := 2.1.0 +DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.gz +DPDK_TAR_URL := http://dpdk.org/browse/dpdk/snapshot/$(DPDK_TARBALL) +DPDK_TARBALL_MD5_CKSUM := 205a0d12bfd6eb717d57506272f43519 +DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION) +DPDK_TARGET := x86_64-native-linuxapp-gcc +JOBS := $(shell grep processor /proc/cpuinfo | wc -l) + +# compiler/linker custom arguments +DPDK_CPU_CFLAGS := -pie -fPIC +DPDK_CPU_LDFLAGS := -pie -fPIC +DPDK_EXTRA_LDFLAGS := -g + +ifeq ($(DPDK_DEBUG),n) +DPDK_EXTRA_CFLAGS := -g +else +DPDK_EXTRA_CFLAGS := -g -O0 +endif + +# translate gcc march values to DPDK arch +ifeq ($(DPDK_MARCH),native) +DPDK_MACHINE:=native # autodetect host CPU +else ifeq ($(DPDK_MARCH),corei7) +DPDK_MACHINE:=nhm # Nehalem / Westmere +else ifeq ($(DPDK_MARCH),corei7-avx) +DPDK_MACHINE:=snb # Sandy Bridge +else ifeq ($(DPDK_MARCH),core-avx-i) +DPDK_MACHINE:=ivb # Ivy Bridge +else ifeq ($(DPDK_MARCH),core-avx2) +DPDK_MACHINE:=hsw # Haswell +else +$(error Unknown DPDK_MARCH) +endif + +# assemble DPDK make arguments +DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \ + T=$(DPDK_TARGET) \ + RTE_CONFIG_TEMPLATE=../custom-config \ + RTE_OUTPUT=$(I) \ + EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \ + EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \ + CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \ + CPU_LDFLAGS="$(DPDK_CPU_LDFLAGS)" + +DPDK_SOURCE_FILES := $(shell [ -e $(DPDK_SOURCE) ] && find $(DPDK_SOURCE) -name "*.[chS]") + +define set +@if grep -q CONFIG_$1 $@ ; \ + then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \ + else echo CONFIG_$1=$2 >> $@ ; \ +fi +endef + +all: build + +$(B)/custom-config: $(B)/.patch.ok Makefile + @echo --- generating custom config from $(DPDK_SOURCE)/config/common_linuxapp --- + @cp $(DPDK_SOURCE)/config/common_linuxapp $@ + $(call set,RTE_MACHINE,$(DPDK_MACHINE)) + $(call set,RTE_ARCH,"x86_64") + $(call set,RTE_ARCH_X86_64,y) + $(call set,RTE_ARCH_64,y) + $(call set,RTE_TOOLCHAIN_GCC,y) + $(call set,RTE_TOOLCHAIN,"gcc") + @# modify options + $(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM)) + $(call set,RTE_LIBEAL_USE_HPET,y) + $(call set,RTE_BUILD_COMBINE_LIBS,y) + $(call set,RTE_LIBRTE_I40E_16BYTE_RX_DESC,y) + $(call set,RTE_LIBRTE_I40E_ITR_INTERVAL,16) + @# enable debug init for device drivers + $(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG)) + $(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG)) + $(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG)) + $(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG)) + $(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG)) + @# not needed + $(call set,RTE_LIBRTE_PMD_BOND,n) + $(call set,RTE_LIBRTE_TIMER,n) + $(call set,RTE_LIBRTE_CFGFILE,n) + $(call set,RTE_LIBRTE_LPM,n) + $(call set,RTE_LIBRTE_ACL,n) + $(call set,RTE_LIBRTE_POWER,n) + $(call set,RTE_LIBRTE_IP_FRAG,n) + $(call set,RTE_LIBRTE_DISTRIBUTOR,n) + $(call set,RTE_LIBRTE_REORDER,n) + $(call set,RTE_LIBRTE_PORT,n) + $(call set,RTE_LIBRTE_TABLE,n) + $(call set,RTE_LIBRTE_PIPELINE,n) + $(call set,RTE_KNI_KMOD,n) + @rm -f .config.ok + +$(CURDIR)/$(DPDK_TARBALL): + @mkdir -p $(B) + @if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \ + then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \ + else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \ + fi + @rm -f $(B)/.download.ok + +$(B)/.download.ok: $(CURDIR)/$(DPDK_TARBALL) + @openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum + @([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_TARBALL_MD5_CKSUM)" ] || \ + ( echo "Bad Checksum! Please remove $< and retry" && \ + rm $(B)/$(DPDK_TARBALL).md5sum && false )) + @touch $@ + +.PHONY: download +download: $(B)/.download.ok + +$(B)/.extract.ok: $(B)/.download.ok + @echo --- extracting $(DPDK_TARBALL) --- + @tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL) --gzip + @touch $@ + +.PHONY: extract +extract: $(B)/.extract.ok + +$(B)/.patch.ok: $(B)/.extract.ok + @echo --- patching --- + for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \ + echo Applying patch: $$(basename $$f) ; \ + patch -p1 -d $(DPDK_SOURCE) < $$f ; \ + done + @touch $@ + +.PHONY: patch +patch: $(B)/.patch.ok + +$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config + @make $(DPDK_MAKE_ARGS) config + @touch $@ + +.PHONY: config +config: $(B)/.config.ok + +$(B)/.build.ok: $(DPDK_SOURCE_FILES) + @if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi + @make $(DPDK_MAKE_ARGS) install + @dkms/create_deb_manifest.sh $(DPDK_VERSION) $(subst $(realpath ..)/,,$(B)) + @touch $@ + +.PHONY: build +build: $(B)/.build.ok + +.PHONY: clean +clean: + @rm -rf $(B) $(I) + diff --git a/dpdk/dkms/Makefile b/dpdk/dkms/Makefile new file mode 100644 index 00000000000..452c7c265e9 --- /dev/null +++ b/dpdk/dkms/Makefile @@ -0,0 +1,10 @@ +obj-m:=igb_uio.o + +CONFIG_MODULE_SIG=n + +EXTRA_CFLAGS += -Winline -I$(PWD) + +default: + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules +clean: + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean diff --git a/dpdk/dkms/create_deb_manifest.sh b/dpdk/dkms/create_deb_manifest.sh new file mode 100755 index 00000000000..e512850ef80 --- /dev/null +++ b/dpdk/dkms/create_deb_manifest.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +VER=$1 +DPDK_ROOT=../../$2/dpdk-${VER} +DEBIAN_DIR=../build-root/deb/debian +SRC_DIR=/usr/src/vpp-dpdk-dkms-${VER}/ + + +cat > ${DEBIAN_DIR}/vpp-dpdk-dkms.install << _EOF_ +${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_feature_defs.h ${SRC_DIR} +${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_features.h ${SRC_DIR} +${DPDK_ROOT}/lib/librte_eal/common/include/rte_pci_dev_ids.h ${SRC_DIR} +${DPDK_ROOT}/lib/librte_eal/linuxapp/igb_uio/igb_uio.c ${SRC_DIR} +${DPDK_ROOT}/lib/librte_eal/linuxapp/igb_uio/compat.h ${SRC_DIR} +../../dpdk/dkms/Makefile ${SRC_DIR} +_EOF_ + + +# dkms config +cat > ${DEBIAN_DIR}/vpp-dpdk-dkms.dkms << _EOF_ +PACKAGE_VERSION="${VER}" +PACKAGE_NAME="vpp-dpdk-dkms" +CLEAN="make clean" +BUILT_MODULE_NAME[0]="igb_uio" +BUILT_MODULE_LOCATION[0]="./" +DEST_MODULE_LOCATION[0]="/kernel/net" +MAKE[1]="make" +AUTOINSTALL="yes" +_EOF_ diff --git a/dpdk/dpdk-2.1.0_patches/0001-kni-fix-igb-build-with-kernel-4.2.patch b/dpdk/dpdk-2.1.0_patches/0001-kni-fix-igb-build-with-kernel-4.2.patch new file mode 100644 index 00000000000..09bca06ed69 --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0001-kni-fix-igb-build-with-kernel-4.2.patch @@ -0,0 +1,78 @@ +From 2de9d1629312a32f82c43167467640bc793805a6 Mon Sep 17 00:00:00 2001 +From: Damjan Marion <damarion@cisco.com> +Date: Mon, 12 Oct 2015 14:23:30 +0200 +Subject: [PATCH 1/9] kni: fix igb build with kernel 4.2 + +Kernel 4.2 has introduced two new parameters in ndo_bridge_getlink, +which breaks DPDK compilation. + +Linux: 7d4f8d87 ("switchdev: ad VLAN support for ports bridge-getlink") + +This patch adds the necessary checks to fix it. + +Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> +--- + lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 13 +++++++++---- + lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 7 ++++++- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +index eed8df6..b330b20 100644 +--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c ++++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +@@ -2250,14 +2250,14 @@ static int igb_ndo_bridge_setlink(struct net_device *dev, + } + + #ifdef HAVE_BRIDGE_FILTER +-#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK ++#ifdef HAVE_NDO_BRIDGE_GETLINK_NLFLAGS + static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, + struct net_device *dev, u32 filter_mask, + int nlflags) + #else + static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, + struct net_device *dev, u32 filter_mask) +-#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */ ++#endif /* HAVE_NDO_BRIDGE_GETLINK_NLFLAGS */ + #else + static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, + struct net_device *dev) +@@ -2275,11 +2275,16 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, + mode = BRIDGE_MODE_VEPA; + + #ifdef HAVE_NDO_FDB_ADD_VID +-#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK ++#ifdef HAVE_NDO_BRIDGE_GETLINK_NLFLAGS ++#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL ++ return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, ++ nlflags, filter_mask, NULL); ++#else + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags); ++#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL */ + #else + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0); +-#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */ ++#endif /* HAVE_NDO_BRIDGE_GETLINK_NLFLAGS */ + #else + return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode); + #endif /* HAVE_NDO_FDB_ADD_VID */ +diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +index 852f80f..5f45b8b 100644 +--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h ++++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +@@ -3899,6 +3899,11 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type) + + #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) ) + /* ndo_bridge_getlink adds new nlflags parameter */ +-#define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK ++#define HAVE_NDO_BRIDGE_GETLINK_NLFLAGS + #endif /* >= 4.1.0 */ ++ ++#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ) ++/* ndo_bridge_getlink adds new filter_mask and vlan_fill parameters */ ++#define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL ++#endif /* >= 4.2.0 */ + #endif /* _KCOMPAT_H_ */ +-- +2.5.0 + diff --git a/dpdk/dpdk-2.1.0_patches/0002-mbuf-rearrange-rte_mbuf-metadata-to-suit-vpp.patch b/dpdk/dpdk-2.1.0_patches/0002-mbuf-rearrange-rte_mbuf-metadata-to-suit-vpp.patch new file mode 100644 index 00000000000..2ce5004a421 --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0002-mbuf-rearrange-rte_mbuf-metadata-to-suit-vpp.patch @@ -0,0 +1,107 @@ +From 3609c4fb4d07d4285e96187598f54cb21e9e9b08 Mon Sep 17 00:00:00 2001 +From: Shesha Sreenivasamurthy <shesha@cisco.com> +Date: Wed, 2 Sep 2015 08:57:24 -0700 +Subject: [PATCH 2/9] mbuf: rearrange rte_mbuf metadata to suit vpp + +Offload structure in the second cache line, next pointer in the +first cache line. Issue reported to Intel. +--- + .../linuxapp/eal/include/exec-env/rte_kni_common.h | 10 +++++++-- + lib/librte_mbuf/rte_mbuf.h | 25 ++++++++++++++-------- + 2 files changed, 24 insertions(+), 11 deletions(-) + +diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +index e9f38bd..d327f71 100644 +--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h ++++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h +@@ -111,6 +111,10 @@ struct rte_kni_fifo { + * The kernel image of the rte_mbuf struct, with only the relevant fields. + * Padding is necessary to assure the offsets of these fields + */ ++/* ++ * offload in the second cache line, next in the first. Better for vpp ++ * at least as of right now. ++ */ + struct rte_kni_mbuf { + void *buf_addr __attribute__((__aligned__(RTE_CACHE_LINE_SIZE))); + char pad0[10]; +@@ -121,16 +125,18 @@ struct rte_kni_mbuf { + char pad2[4]; + uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ + uint16_t data_len; /**< Amount of data in segment buffer. */ ++ char pad3[2]; + #else + char pad2[2]; + uint16_t data_len; /**< Amount of data in segment buffer. */ + uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ ++ char pad3[4]; + #endif ++ void *next; + + /* fields on second cache line */ +- char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_SIZE))); ++ char pad4[12] __attribute__((__aligned__(RTE_CACHE_LINE_SIZE))); + void *pool; +- void *next; + }; + + /* +diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h +index 8c2db1b..61cbbd7 100644 +--- a/lib/librte_mbuf/rte_mbuf.h ++++ b/lib/librte_mbuf/rte_mbuf.h +@@ -743,6 +743,12 @@ typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes + /** + * The generic rte_mbuf, containing a packet mbuf. + */ ++/* ++ * offload in the second cache line, next in the first. Better for vpp ++ * at least as of right now. ++ * If you change this structure, you must change the user-mode ++ * version in rte_mbuf.h ++ */ + struct rte_mbuf { + MARKER cacheline0; + +@@ -809,6 +815,16 @@ struct rte_mbuf { + uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order) */ + uint16_t vlan_tci_outer; /**< Outer VLAN Tag Control Identifier (CPU order) */ + #endif /* RTE_NEXT_ABI */ ++ struct rte_mbuf *next; /**< Next segment of scattered packet. */ ++ ++ uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */ ++#ifdef RTE_NEXT_ABI ++ uint16_t vlan_tci_outer; /**< Outer VLAN Tag Control Identifier (CPU order) */ ++#endif /* RTE_NEXT_ABI */ ++ ++ /* second cache line - fields only used in slow path or on TX */ ++ MARKER cacheline1 __rte_cache_aligned; ++ + union { + uint32_t rss; /**< RSS hash result if RSS enabled */ + struct { +@@ -828,21 +844,12 @@ struct rte_mbuf { + uint32_t usr; /**< User defined tags. See rte_distributor_process() */ + } hash; /**< hash information */ + +- uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */ +-#ifdef RTE_NEXT_ABI +- uint16_t vlan_tci_outer; /**< Outer VLAN Tag Control Identifier (CPU order) */ +-#endif /* RTE_NEXT_ABI */ +- +- /* second cache line - fields only used in slow path or on TX */ +- MARKER cacheline1 __rte_cache_aligned; +- + union { + void *userdata; /**< Can be used for external metadata */ + uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */ + }; + + struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ +- struct rte_mbuf *next; /**< Next segment of scattered packet. */ + + /* fields to support TX offloads */ + union { +-- +2.5.0 + diff --git a/dpdk/dpdk-2.1.0_patches/0003-e1000-Set-VLAN-Rx-Offload-tag-correctly.patch b/dpdk/dpdk-2.1.0_patches/0003-e1000-Set-VLAN-Rx-Offload-tag-correctly.patch new file mode 100644 index 00000000000..d1ea27ad778 --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0003-e1000-Set-VLAN-Rx-Offload-tag-correctly.patch @@ -0,0 +1,75 @@ +From 699252f0b685db4cd298e90f0e1d64e4792356f2 Mon Sep 17 00:00:00 2001 +From: Damjan Marion <damarion@cisco.com> +Date: Wed, 21 Oct 2015 14:46:12 +0200 +Subject: [PATCH 3/9] e1000: Set VLAN Rx Offload tag correctly + +--- + drivers/net/e1000/igb_rxtx.c | 30 ++++++++++++++++++++++++++++++ + lib/librte_ether/rte_ether.h | 3 +++ + 2 files changed, 33 insertions(+) + +diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c +index b13930e..7fe76c8 100644 +--- a/drivers/net/e1000/igb_rxtx.c ++++ b/drivers/net/e1000/igb_rxtx.c +@@ -885,6 +885,21 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss); + pkt_flags = pkt_flags | rx_desc_status_to_pkt_flags(staterr); + pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr); ++ { ++ /* ++ * Check packet for VLAN ethernet types and set ++ * RX Offload flag PKT_RX_VLAN_PKT accordingly. ++ */ ++ struct ether_hdr *eth_hdr = ++ rte_pktmbuf_mtod(rxm, struct ether_hdr *); ++ u16 eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); ++ ++ if ((eth_type == ETHER_TYPE_VLAN) || ++ (eth_type == ETHER_TYPE_VLAN_AD) || ++ (eth_type == ETHER_TYPE_VLAN_9100) || ++ (eth_type == ETHER_TYPE_VLAN_9200)) ++ pkt_flags |= PKT_RX_VLAN_PKT; ++ } + rxm->ol_flags = pkt_flags; + #ifdef RTE_NEXT_ABI + rxm->packet_type = igb_rxd_pkt_info_to_pkt_type(rxd.wb.lower. +@@ -1123,6 +1138,21 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss); + pkt_flags = pkt_flags | rx_desc_status_to_pkt_flags(staterr); + pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr); ++ { ++ /* ++ * Check packet for VLAN ethernet types and set ++ * RX Offload flag PKT_RX_VLAN_PKT accordingly. ++ */ ++ struct ether_hdr *eth_hdr = ++ rte_pktmbuf_mtod(rxm, struct ether_hdr *); ++ u16 eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); ++ ++ if ((eth_type == ETHER_TYPE_VLAN) || ++ (eth_type == ETHER_TYPE_VLAN_AD) || ++ (eth_type == ETHER_TYPE_VLAN_9100) || ++ (eth_type == ETHER_TYPE_VLAN_9200)) ++ pkt_flags |= PKT_RX_VLAN_PKT; ++ } + first_seg->ol_flags = pkt_flags; + #ifdef RTE_NEXT_ABI + first_seg->packet_type = igb_rxd_pkt_info_to_pkt_type(rxd.wb. +diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h +index 07c17d7..fd646ec 100644 +--- a/lib/librte_ether/rte_ether.h ++++ b/lib/librte_ether/rte_ether.h +@@ -332,6 +332,9 @@ struct vxlan_hdr { + #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */ + #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */ + #define ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ ++#define ETHER_TYPE_VLAN_AD 0x88a8 /**< IEEE 802.1AD VLAN tagging. */ ++#define ETHER_TYPE_VLAN_9100 0x9100 /**< VLAN 0x9100 tagging. */ ++#define ETHER_TYPE_VLAN_9200 0x9200 /**< VLAN 0x9200 tagging. */ + + #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr)) + /**< VXLAN tunnel header length. */ +-- +2.5.0 + diff --git a/dpdk/dpdk-2.1.0_patches/0004-ixgbe-Wait-a-bit-longer-for-autonegotiation-to-leave.patch b/dpdk/dpdk-2.1.0_patches/0004-ixgbe-Wait-a-bit-longer-for-autonegotiation-to-leave.patch new file mode 100644 index 00000000000..75241173afd --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0004-ixgbe-Wait-a-bit-longer-for-autonegotiation-to-leave.patch @@ -0,0 +1,26 @@ +From 67d1c25af7fa16df40a8305405066ba6a40ac659 Mon Sep 17 00:00:00 2001 +From: Shesha Sreenivasamurthy <shesha@cisco.com> +Date: Wed, 2 Sep 2015 08:46:39 -0700 +Subject: [PATCH 4/9] ixgbe: Wait a bit longer for autonegotiation to leave + state 0 + +--- + drivers/net/ixgbe/base/ixgbe_82599.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ixgbe/base/ixgbe_82599.c b/drivers/net/ixgbe/base/ixgbe_82599.c +index f0deb59..ae66380 100644 +--- a/drivers/net/ixgbe/base/ixgbe_82599.c ++++ b/drivers/net/ixgbe/base/ixgbe_82599.c +@@ -2442,7 +2442,7 @@ s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw) + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, + autoc_reg ^ (0x4 << IXGBE_AUTOC_LMS_SHIFT)); + /* Wait for AN to leave state 0 */ +- for (i = 0; i < 10; i++) { ++ for (i = 0; i < 50; i++) { + msec_delay(4); + anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); + if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK) +-- +2.5.0 + diff --git a/dpdk/dpdk-2.1.0_patches/0005-eal-Temporarily-turn-off-unthrottled-RTE_LOG.patch b/dpdk/dpdk-2.1.0_patches/0005-eal-Temporarily-turn-off-unthrottled-RTE_LOG.patch new file mode 100644 index 00000000000..245b43c196e --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0005-eal-Temporarily-turn-off-unthrottled-RTE_LOG.patch @@ -0,0 +1,29 @@ +From 9e28214eb784b9f68af6e0503f8cefe861f13440 Mon Sep 17 00:00:00 2001 +From: Shesha Sreenivasamurthy <shesha@cisco.com> +Date: Wed, 2 Sep 2015 08:55:43 -0700 +Subject: [PATCH 5/9] eal: Temporarily turn off unthrottled RTE_LOG(...) + +Otherwise, /var/log/syslog eventually fills the disk. The error +condition seems only to affect ESXi VM's. It'd be worth suggesting log +throttling to the DPDK community. Much better to avoid making syslog +(...) calls in the first place. +--- + lib/librte_eal/linuxapp/eal/eal_interrupts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c +index 3f87875..29a3539 100644 +--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c ++++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c +@@ -709,7 +709,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) + * for epoll_wait. + */ + bytes_read = read(events[n].data.fd, &buf, bytes_read); +- if (bytes_read < 0) { ++ if (0 && bytes_read < 0) { + if (errno == EINTR || errno == EWOULDBLOCK) + continue; + +-- +2.5.0 + diff --git a/dpdk/dpdk-2.1.0_patches/0006-virtio-Cleanup-virtio-pmd-debug-log-output-reset-off.patch b/dpdk/dpdk-2.1.0_patches/0006-virtio-Cleanup-virtio-pmd-debug-log-output-reset-off.patch new file mode 100644 index 00000000000..9306f112a2c --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0006-virtio-Cleanup-virtio-pmd-debug-log-output-reset-off.patch @@ -0,0 +1,77 @@ +From 21a9bf50270f71ebda5acb5fc233b8279cec56a7 Mon Sep 17 00:00:00 2001 +From: Shesha Sreenivasamurthy <shesha@cisco.com> +Date: Wed, 2 Sep 2015 08:48:09 -0700 +Subject: [PATCH 6/9] virtio: Cleanup virtio pmd debug log output, reset + offload field + +--- + drivers/net/virtio/virtio_ethdev.c | 10 +++++----- + drivers/net/virtio/virtio_rxtx.c | 4 +++- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c +index 465d3cd..6a686fe 100644 +--- a/drivers/net/virtio/virtio_ethdev.c ++++ b/drivers/net/virtio/virtio_ethdev.c +@@ -1521,24 +1521,24 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet + link.link_speed = SPEED_10G; + + if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { +- PMD_INIT_LOG(DEBUG, "Get link status from hw"); + vtpci_read_dev_config(hw, + offsetof(struct virtio_net_config, status), + &status, sizeof(status)); + if ((status & VIRTIO_NET_S_LINK_UP) == 0) { + link.link_status = 0; +- PMD_INIT_LOG(DEBUG, "Port %d is down", +- dev->data->port_id); + } else { + link.link_status = 1; +- PMD_INIT_LOG(DEBUG, "Port %d is up", +- dev->data->port_id); + } + } else { + link.link_status = 1; /* Link up */ + } + virtio_dev_atomic_write_link_status(dev, &link); + ++ /* This message is far too noisy for normal use */ ++ if (0) ++ PMD_INIT_LOG(DEBUG, "Port %d is %s\n", dev->data->port_id, ++ link.link_status ? "up" : "down"); ++ + return (old.link_status == link.link_status) ? -1 : 0; + } + +diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c +index c5b53bb..9f0b759 100644 +--- a/drivers/net/virtio/virtio_rxtx.c ++++ b/drivers/net/virtio/virtio_rxtx.c +@@ -536,6 +536,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) + rxm->next = NULL; + rxm->pkt_len = (uint32_t)(len[i] - hdr_size); + rxm->data_len = (uint16_t)(len[i] - hdr_size); ++ rxm->ol_flags = 0; + + if (hw->vlan_strip) + rte_vlan_strip(rxm); +@@ -651,6 +652,7 @@ virtio_recv_mergeable_pkts(void *rx_queue, + rxm->next = NULL; + rxm->pkt_len = (uint32_t)(len[0] - hdr_size); + rxm->data_len = (uint16_t)(len[0] - hdr_size); ++ rxm->ol_flags = 0; + + rxm->port = rxvq->port_id; + rx_pkts[nb_rx] = rxm; +@@ -752,7 +754,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) + if (unlikely(nb_pkts < 1)) + return nb_pkts; + +- PMD_TX_LOG(DEBUG, "%d packets to xmit", nb_pkts); ++ PMD_TX_LOG(DEBUG, "%d packets to xmit\n", nb_pkts); + nb_used = VIRTQUEUE_NUSED(txvq); + + virtio_rmb(); +-- +2.5.0 + diff --git a/dpdk/dpdk-2.1.0_patches/0007-igb_uio-Reinstate-PCI-device-id-table-build-system-c.patch b/dpdk/dpdk-2.1.0_patches/0007-igb_uio-Reinstate-PCI-device-id-table-build-system-c.patch new file mode 100644 index 00000000000..b92fca4cb5d --- /dev/null +++ b/dpdk/dpdk-2.1.0_patches/0007-igb_uio-Reinstate-PCI-device-id-table-build-system-c.patch @@ -0,0 +1,49 @@ +From 3ac6cb020c0f2ddb42dcd790cf64118453e966a2 Mon Sep 17 00:00:00 2001 +From: Shesha Sreenivasamurthy <shesha@cisco.com> +Date: Wed, 2 Sep 2015 08:48:41 -0700 +Subject: [PATCH 7/9] igb_uio: Reinstate PCI device id table, build system + changes + +--- + lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 18 +++++++++++++++++- + 3 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +index 865a276..16d2a55 100644 +--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c ++++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +@@ -61,6 +61,22 @@ struct rte_uio_pci_dev { + static char *intr_mode = NULL; + static enum rte_intr_mode igbuio_intr_mode_preferred = RTE_INTR_MODE_MSIX; + ++/* PCI device id table */ ++static struct pci_device_id igbuio_pci_ids[] = { ++#define RTE_PCI_DEV_ID_DECL_EM(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_IGB(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_IGBVF(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_VIRTIO(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_VMXNET3(vend, dev) {PCI_DEVICE(vend, dev)}, ++#define RTE_PCI_DEV_ID_DECL_VICE(vend, dev) {PCI_DEVICE(vend, dev)}, ++#include <rte_pci_dev_ids.h> ++{ 0, }, ++}; ++ ++MODULE_DEVICE_TABLE(pci, igbuio_pci_ids); ++ + static inline struct rte_uio_pci_dev * + igbuio_get_uio_pci_dev(struct uio_info *info) + { +@@ -606,7 +622,7 @@ igbuio_config_intr_mode(char *intr_str) + + static struct pci_driver igbuio_pci_driver = { + .name = "igb_uio", +- .id_table = NULL, ++ .id_table = igbuio_pci_ids, + .probe = igbuio_pci_probe, + .remove = igbuio_pci_remove, + }; +-- +2.5.0 + |