diff --git a/README.md b/README.md index 0ecd9a8b5..6a4edf8ad 100644 --- a/README.md +++ b/README.md @@ -38,30 +38,35 @@ Currently, besides authorized DNS server of DNSPod, there are various products i yum install numactl-devel # on Centos #sudo apt-get install libnuma-dev # on Ubuntu + # Install dependencies (FreeBSD only) + #pkg install meson pkgconf py38-pyelftools + cd f-stack # Compile DPDK cd dpdk/usertools ./dpdk-setup.sh # compile with x86_64-native-linuxapp-gcc - # Set hugepage + # Set hugepage (Linux only) # single-node system echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages - # or NUMA + # or NUMA (Linux only) echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages - # Using Hugepage with the DPDK + # Using Hugepage with the DPDK (Linux only) mkdir /mnt/huge mount -t hugetlbfs nodev /mnt/huge - # Close ASLR; it is necessary in multiple process + # Close ASLR; it is necessary in multiple process (Linux only) echo 0 > /proc/sys/kernel/randomize_va_space # Install python for running DPDK python scripts sudo apt install python # On ubuntu + #sudo pkg install python # On FreeBSD # Offload NIC + # For Linux: modprobe uio insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko carrier=on # carrier=on is necessary, otherwise need to be up `veth0` via `echo 1 > /sys/class/net/veth0/carrier` @@ -69,6 +74,15 @@ Currently, besides authorized DNS server of DNSPod, there are various products i ifconfig eth0 down python dpdk-devbind.py --bind=igb_uio eth0 # assuming that use 10GE NIC and eth0 + # For FreeBSD: + # Refer DPDK FreeBSD guide to set tunables in /boot/loader.conf + # Below is an example used for our testing machine + #echo "hw.nic_uio.bdfs=\"2:0:0\"" >> /boot/loader.conf + #echo "hw.contigmem.num_buffers=1" >> /boot/loader.conf + #echo "hw.contigmem.buffer_size=1073741824" >> /boot/loader.conf + #kldload contigmem + #kldload nic_uio + # Install DPDK cd ../x86_64-native-linuxapp-gcc make install @@ -77,20 +91,23 @@ Currently, besides authorized DNS server of DNSPod, there are various products i #sudo apt-get install gawk # or execute `sudo update-alternatives --config awk` to choose gawk. # Install dependencies for F-Stack - sudo apt install gcc make libssl-dev # On ubuntu + sudo apt install gcc make libssl-dev # On ubuntu + #sudo pkg install gcc gmake openssl pkgconf libepoll-shim # On FreeBSD # Compile F-Stack export FF_PATH=/data/f-stack export FF_DPDK=/data/f-stack/dpdk/x86_64-native-linuxapp-gcc cd ../../lib/ - make + make # On Linux + #gmake # On FreeBSD # Install F-STACK # libfstack.a will be installed to /usr/local/lib # ff_*.h will be installed to /usr/local/include # start.sh will be installed to /usr/local/bin/ff_start # config.ini will be installed to /etc/f-stack.conf - make install + make install # On Linux + #gmake install # On FreeBSD #### Nginx @@ -165,4 +182,4 @@ See [LICENSE](LICENSE) Tencent Cloud F-Stack team developed F-Stack which is a general network framework based on DPDK and provides ultra high network performance. We are here looking for more and more talented people with great passion on technology to join us. You would have the chance to work with brightest minds on this planet and help Tencent cloud and F-stack continuously evolve. Send us your resume or refer your friend to us if you are interested in joining us. Open Positions: Software engineer(C/C++), Web developer, IOS/Android developer, Product Manager, Operating Manager, etc. -Contact: Please send your resume to [us](mailto:allanhuang@tencent.com) +Contact: Please send your resume to [us](mailto:fengbojiang@tencent.com) diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..ce2dd5357 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.21.5 diff --git a/app/micro_thread/Makefile b/app/micro_thread/Makefile index a8713672a..57d0c2367 100644 --- a/app/micro_thread/Makefile +++ b/app/micro_thread/Makefile @@ -37,7 +37,7 @@ FF_LIBS+= -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -lpthread -lnuma # Comment the following line if you are not using the gnu c compiler #C_ARGS = -Wall -g -fPIC -D_DEBUG -C_ARGS = -Wall -g -fPIC -O0 -DMT_REAL_TIME +C_ARGS = -Wall -g -fPIC -O0 -DMT_REAL_TIME -Wno-register #.SUFFIXES: .o .cpp ifeq ($(ARCH),32) diff --git a/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c b/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c index 9fdb7200e..b0417f79c 100644 --- a/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c +++ b/app/nginx-1.16.1/src/event/modules/ngx_ff_module.c @@ -546,7 +546,11 @@ kevent(int kq, const struct kevent *changelist, int nchanges, } int +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 31) +gettimeofday(struct timeval *tv, void *tz) +#else gettimeofday(struct timeval *tv, struct timezone *tz) +#endif { if (unlikely(inited == 0)) { return SYSCALL(gettimeofday)(tv, tz); diff --git a/app/nginx-1.16.1/src/event/ngx_event_connect.c b/app/nginx-1.16.1/src/event/ngx_event_connect.c index de67b3472..36858f482 100644 --- a/app/nginx-1.16.1/src/event/ngx_event_connect.c +++ b/app/nginx-1.16.1/src/event/ngx_event_connect.c @@ -40,7 +40,7 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) #if (NGX_HAVE_FSTACK) /* - We use a creation flags created by fstack's adaptable layer to + We use a creation flags created by fstack's adaptable layer to to explicitly call the needed socket() function. */ if (!pc->belong_to_host) { @@ -209,7 +209,7 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) if (ngx_event_actions.add_conn) { #else if (ngx_add_conn) { - #endif +#endif if (ngx_add_conn(c) == NGX_ERROR) { goto failed; } @@ -349,10 +349,20 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) #if (NGX_HAVE_TRANSPARENT_PROXY) +#if (NGX_HAVE_FSTACK) +extern int is_fstack_fd(int sockfd); +#ifndef IP_BINDANY +#define IP_BINDANY 24 +#endif +#endif + static ngx_int_t ngx_event_connect_set_transparent(ngx_peer_connection_t *pc, ngx_socket_t s) { int value; +#if defined(NGX_HAVE_FSTACK) + int optname; +#endif value = 1; @@ -377,16 +387,21 @@ ngx_event_connect_set_transparent(ngx_peer_connection_t *pc, ngx_socket_t s) FreeBSD define IP_BINDANY in freebsd/netinet/in.h Fstack should only support IP_BINDANY. ****/ - #define IP_BINDANY 24 - if (setsockopt(s, IPPROTO_IP, IP_BINDANY, + if(is_fstack_fd(s)){ + optname = IP_BINDANY; + } else { + optname = IP_TRANSPARENT; + } + + if (setsockopt(s, IPPROTO_IP, optname, (const void *) &value, sizeof(int)) == -1) { ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, - "setsockopt(IP_BINDANY) failed"); + "setsockopt(IP_BINDANY/IP_TRANSPARENT) failed"); return NGX_ERROR; } - -#elif defined(IP_TRANSPARENT) + +#elif defined(IP_TRANSPARENT) if (setsockopt(s, IPPROTO_IP, IP_TRANSPARENT, (const void *) &value, sizeof(int)) == -1) { diff --git a/app/redis-5.0.5/src/sds.h b/app/redis-5.0.5/src/sds.h index 1bdb60dec..adcc12c0a 100644 --- a/app/redis-5.0.5/src/sds.h +++ b/app/redis-5.0.5/src/sds.h @@ -34,7 +34,7 @@ #define __SDS_H #define SDS_MAX_PREALLOC (1024*1024) -const char *SDS_NOINIT; +extern const char *SDS_NOINIT; #include #include diff --git a/config.ini b/config.ini index 4ad442aac..aad1184b9 100644 --- a/config.ini +++ b/config.ini @@ -24,6 +24,10 @@ tso=0 # HW vlan strip, default: enabled. vlan_strip=1 +# Set vlan filter id, to enable L3/L4 RSS below vlan hdr. +# the format is same as port_list +#vlan_filter=1,2,4-6 + # sleep when no pkts incomming # unit: microseconds idle_sleep=0 @@ -56,6 +60,7 @@ symmetric_rss=0 # such as, port 0 and port 1 trank to a bonding port 2, # should set `port_list=2` and config `[port2]` section +#pci_whitelist=af:00.0 port_list=0 # Number of vdev. @@ -79,12 +84,31 @@ addr=192.168.1.2 netmask=255.255.255.0 broadcast=192.168.1.255 gateway=192.168.1.1 +# set interface name, Optional parameter. +#if_name=f-stack-0 # IPv6 net addr # Optional parameters #addr6=ff::02 #prefix_len=64 #gateway6=ff::01 +# Multi virtual IPv4/IPv6 net addr, Optional parameters. +# `vip_ifname`: default `f-stack-x` +# `vip_addr`: Separated by semicolons, MAX number 64; +# Only support netmask 255.255.255.255, broadcast x.x.x.255 now, hard code in `ff_veth_setvaddr`. +# `ipfw_pr`: Set simplest policy routing, Optional parameters. +# Such as the cmd `ff_ipfw -P 0 add 100 setfib 0 ip from 192.168.0.0/24 to any out` +# can set parameter`192.168.0.0 255.255.255.0`, cidr and netmask separated by space. +# Multi cidr separated by semicolons. +# IPv4 only now, and if you want set more complex policy routing, should use tool `ff_ipfw`. +# `vip_addr6`: Separated by semicolons, MAX number 64. +# `vip_prefix_len`: All addr6 use the same prefix now, default 64. +#vip_ifname=lo0 +#vip_addr=192.168.0.3;192.168.0.4;192.168.0.5;192.168.0.6 +#ipfw_pr=192.168.0.0 255.255.255.0;192.168.10.0 255.255.255.0 +#vip_addr6=ff::03;ff::04;ff::05;ff::06;ff::07 +#vip_prefix_len=64 + # lcore list used to handle this port # the format is same as port_list #lcore_list=0 @@ -94,8 +118,54 @@ gateway=192.168.1.1 # the format is same as port_list #slave_port_list=0,1 -# Packet capture path, this will hurt performance -#pcap=./a.pcap +# Vlan config section, Must set after all [portN] +# NOTE1: Must enable dpdk.vlan_filter first, and match it. +# NOTE2: If enable vlan config, all [PortN] config will be ignored! +#[vlan1] +#portid=0 +#addr=192.169.0.2 +#netmask=255.255.255.0 +#broadcast=192.169.0.255 +#gateway=192.169.0.1 +# +#vip_addr=192.169.0.3;192.169.0.4;192.169.0.5;192.169.0.6 +#ipfw_pr=192.169.0.0 255.255.255.0;192.169.10.0 255.255.255.0 +# +#[vlan2] +#portid=0 +#addr=192.169.1.2 +#netmask=255.255.255.0 +#broadcast=192.169.1.255 +#gateway=192.169.1.1 +# +#vip_addr=192.169.1.3;192.169.1.4;192.169.1.5;192.169.1.6 +#ipfw_pr=192.169.1.0 255.255.255.0;192.169.11.0 255.255.255.0 +# +#[vlan4] +#portid=0 +#addr=192.169.2.2 +#netmask=255.255.255.0 +#broadcast=192.169.2.255 +#gateway=192.169.2.1 +# +#vip_addr=192.169.2.3;192.169.2.4;192.169.2.5;192.169.2.6 +#ipfw_pr=192.169.2.0 255.255.255.0;192.169.12.0 255.255.255.0 +# +#[vlan5] +#portid=0 +#addr=192.169.3.2 +#netmask=255.255.255.0 +#broadcast=192.169.3.255 +#gateway=192.169.3.1 +# +#addr6=fe::32 +#prefix_len=64 +#gateway6=fe::31 +# +#vip_addr=192.169.3.3;192.169.3.4;192.169.3.5;192.169.3.6 +#ipfw_pr=192.169.3.0 255.255.255.0;192.169.13.0 255.255.255.0 +#vip_addr6=fe::33;fe::34;fe::35;fe::36;fe::37 +#vip_prefix_len=64 # Vdev config section # orrespond to dpdk.nb_vdev's index: vdev0, vdev1... @@ -137,6 +207,14 @@ gateway=192.168.1.1 # The format is same as port_list #tcp_port=80,443 #udp_port=53 +# KNI ratelimit value, default: 0, means disable ratelimit. +# example: +# The total speed limit for a single process entering the kni ring is 10,000 QPS, +# 1000 QPS for general packets, 9000 QPS for console packets (ospf/arp, etc.) +# The total speed limit for kni forwarding to the kernel is 20,000 QPS. +#console_packets_ratelimit=0 +#general_packets_ratelimit=0 +#kernel_packets_ratelimit=0 # FreeBSD network performance tuning configurations. # Most native FreeBSD configurations are supported. diff --git a/doc/F-Stack_Nginx_APP_Guide.md b/doc/F-Stack_Nginx_APP_Guide.md index e667b0f1b..4931c31a7 100644 --- a/doc/F-Stack_Nginx_APP_Guide.md +++ b/doc/F-Stack_Nginx_APP_Guide.md @@ -55,7 +55,7 @@ All the directives below are available only when ```NGX_HAVE_FSTACK``` is define ``` Syntax: proxy_kernel_network_stack on | off; - Default: kernel_network_stack off; + Default: proxy_kernel_network_stack off; Context: http, stream, mail, server Determines whether proxy should go through kernel network stack or fstack. diff --git a/doc/F-Stack_Release_Note.md b/doc/F-Stack_Release_Note.md index 104d357f4..c95676f22 100644 --- a/doc/F-Stack_Release_Note.md +++ b/doc/F-Stack_Release_Note.md @@ -2,6 +2,91 @@ F-Stack is an open source network framework based on DPDK. +2024.10 F-Stack v1.21.5(LTS) + +1. F-Stack lib: + +- Modify ff_port_cfg.port_id's type from uint8_t to unint16_t. +- Modify INI_MAX_LINE from 200 to 2048 in lib/ff_ini_parser.h. +- IPv6 addr and vaddr set autoconf by default. +- Modify IPv4 vip addrs' broadaddr from x.x.x.255 to x.x.x.x, same as vip addr, because vips' netmask only support `255.255.255.255` now. +- Add APi ff_dpdk_raw_packet_send to suppoort RAW packet send direty with DPDK by user APP not via socket. +- Support automatic configuration of vlan and vlan ip, routing and the simplest policy routing. +- Use soclose() instead of sofree() when initializing the configuration stack IP. +- Support KNI ratelimit, default disable. +- The msghdr.msg_iov->iov_base and msghdr.msg_iov->iov_len of ff_sendmsg() and ff_recvmsg() compatible with the Linux. + +1. FreeBSD + +- Fix issue in Freebsd when building with GCC 14.1.0. @bjosv + +1. ff toos + +- Fix ff tools build error with gcc-13.2.0. + +1. DPDK + +- Fix some build errors of dpdk-19.11.14 with gcc-13.2.0. + +1. APP + +- Nginx: Nginx's stream support transparent. + +1. doc + +- Update ff tools README.md, use `ff_netstat -rnW` to display wider device name. +- Fix a typo in doc/F-Stack_Nginx_APP_Guide.md: "kernel_network_stack" -> "proxy_kernel_network_stack". + + + +2023.10 F-Stack v1.21.4(LTS) + + 1. F-Stack lib: + + - Add vlan_filter argument in config.ini for RSS with vlan. + - Set Rx VLAN filter, and then the dirvier(such as MLX5) will set FLOW RSS to enable L3/L4 RSS below vlan hdr. This action won't need after DPDK-20.11. + - Fix Compile Error with gcc 12.2.0. + - gettimeofday automatically compatible with different glibc versions. + - Add an API ff_get_traffic to get traffic for QoS or other. + + 2. ff tools: + + - Fix Compile Error with gcc 12.2.0. + + 3. APP: + + - gettimeofday automatically compatible with different glibc versions. + + + +2023.09 F-Stack v1.21.3(LTS) + + 1. F-Stack lib, Sync some features from branch of dev: + + - vlan_strip support kni. + - Fix Compile Error with gcc 11.3.0(in Ubuntu 22.04). + - Added F-Stack FreeBSD support. see 9f7a142 . + - Enable INET6 by default in helloworld. see 51c91ab . + - Added FDIR support. see 4854315 . + - To avoid compiling errors when gcc version >= 10. see 6daadb0 . + - Modify `struct linux_sockaddr` same to `struct sockaddr` in linux. see d96a9d1 . + - Sync some modified of ff_config.c, inclue set dpdk log level, Avoid memory leaks, suppor vip_addr and vip_addr6, etc. see git log lib/ff_config.c in branch of dev. + - Sync some modified of ff_syscall_wrapper.c, include ff_sendmsg, ff_recvmsg, ip6_opt_convert, etc. see git log lib/ff_syscall_wrapper.c in branch of dev. + - The CPU usage of packet_dispatcher() is modified to usr. see 0508c8b . + - If process_dispatch_ring() has data packet to be processed and it is considered non-idle state. see 81dd6c7 . + - Fix a plurality of packets may not statistics in ff_traffic.rx_packets and ff_traffic.rx_bytes. see 0b4a084 . + - Added FF_IPSEC=1 in lib/Makefile, disable by default. + - Some other modified. + + 2. DPDK: + + - DPDK: Upgrade to 19.11.14(LTS). + + 3. APP: + + - Fiexd some build errors of micro_thread on ubuntu 22.04. + + 2022.09 F-Stack v1.21.2(LTS) 1. F-Stack lib: diff --git a/dpdk/VERSION b/dpdk/VERSION index 0698e5a37..d09cf7101 100644 --- a/dpdk/VERSION +++ b/dpdk/VERSION @@ -1 +1 @@ -19.11.13 +19.11.14 diff --git a/dpdk/app/test-pmd/meson.build b/dpdk/app/test-pmd/meson.build index b0249bdb3..3a6d943ee 100644 --- a/dpdk/app/test-pmd/meson.build +++ b/dpdk/app/test-pmd/meson.build @@ -47,6 +47,7 @@ if dpdk_conf.has('RTE_LIBRTE_I40E_PMD') deps += 'pmd_i40e' endif if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD') + cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS'] deps += 'pmd_ixgbe' endif if dpdk_conf.has('RTE_LIBRTE_SOFTNIC_PMD') diff --git a/dpdk/app/test-pmd/noisy_vnf.c b/dpdk/app/test-pmd/noisy_vnf.c index 58c4ee925..76e037f79 100644 --- a/dpdk/app/test-pmd/noisy_vnf.c +++ b/dpdk/app/test-pmd/noisy_vnf.c @@ -56,8 +56,8 @@ do_write(char *vnf_mem) static inline void do_read(char *vnf_mem) { + uint64_t r __rte_unused; uint64_t i = rte_rand(); - uint64_t r; r = vnf_mem[i % ((noisy_lkup_mem_sz * 1024 * 1024) / RTE_CACHE_LINE_SIZE)]; diff --git a/dpdk/app/test-pmd/testpmd.c b/dpdk/app/test-pmd/testpmd.c index 379f867ca..9028b2d95 100644 --- a/dpdk/app/test-pmd/testpmd.c +++ b/dpdk/app/test-pmd/testpmd.c @@ -208,7 +208,7 @@ uint16_t stats_period; /**< Period to show statistics (disabled by default) */ * In container, it cannot terminate the process which running with 'stats-period' * option. Set flag to exit stats period loop after received SIGINT/SIGTERM. */ -uint8_t f_quit; +static volatile uint8_t f_quit; uint8_t cl_quit; /* Quit testpmd from cmdline. */ /* diff --git a/dpdk/app/test/test_common.c b/dpdk/app/test/test_common.c index 12bd1cad9..181c8be3b 100644 --- a/dpdk/app/test/test_common.c +++ b/dpdk/app/test/test_common.c @@ -25,27 +25,49 @@ test_macros(int __rte_unused unused_parm) #define SMALLER 0x1000U #define BIGGER 0x2000U #define PTR_DIFF BIGGER - SMALLER -#define FAIL_MACRO(x)\ - {printf(#x "() test failed!\n");\ - return -1;} uintptr_t unused = 0; + uint32_t arr[3]; RTE_SET_USED(unused); - if ((uintptr_t)RTE_PTR_ADD(SMALLER, PTR_DIFF) != BIGGER) - FAIL_MACRO(RTE_PTR_ADD); - if ((uintptr_t)RTE_PTR_SUB(BIGGER, PTR_DIFF) != SMALLER) - FAIL_MACRO(RTE_PTR_SUB); - if (RTE_PTR_DIFF(BIGGER, SMALLER) != PTR_DIFF) - FAIL_MACRO(RTE_PTR_DIFF); - if (RTE_MAX(SMALLER, BIGGER) != BIGGER) - FAIL_MACRO(RTE_MAX); - if (RTE_MIN(SMALLER, BIGGER) != SMALLER) - FAIL_MACRO(RTE_MIN); - - if (strncmp(RTE_STR(test), "test", sizeof("test"))) - FAIL_MACRO(RTE_STR); + RTE_TEST_ASSERT_EQUAL((uintptr_t)RTE_PTR_ADD(SMALLER, PTR_DIFF), BIGGER, + "RTE_PTR_ADD"); + RTE_TEST_ASSERT_EQUAL((uintptr_t)RTE_PTR_SUB(BIGGER, PTR_DIFF), SMALLER, + "RTE_PTR_SUB"); + RTE_TEST_ASSERT_EQUAL(RTE_PTR_DIFF(BIGGER, SMALLER), PTR_DIFF, + "RTE_PTR_DIFF"); + RTE_TEST_ASSERT_EQUAL(RTE_MAX(SMALLER, BIGGER), BIGGER, + "RTE_MAX"); + RTE_TEST_ASSERT_EQUAL(RTE_MIN(SMALLER, BIGGER), SMALLER, + "RTE_MIN"); + + RTE_TEST_ASSERT_EQUAL(RTE_PTR_ADD(arr + 1, sizeof(arr[0])), &arr[2], + "RTE_PTR_ADD(expr, x)"); + RTE_TEST_ASSERT_EQUAL(RTE_PTR_SUB(arr + 1, sizeof(arr[0])), &arr[0], + "RTE_PTR_SUB(expr, x)"); + RTE_TEST_ASSERT_EQUAL(RTE_PTR_ALIGN_FLOOR(arr + 2, 4), &arr[2], + "RTE_PTR_ALIGN_FLOOR(expr, x)"); + RTE_TEST_ASSERT_EQUAL(RTE_PTR_ALIGN_CEIL(arr + 2, 4), &arr[2], + "RTE_PTR_ALIGN_CEIL(expr, x)"); + RTE_TEST_ASSERT_EQUAL(RTE_PTR_ALIGN(arr + 2, 4), &arr[2], + "RTE_PTR_ALIGN(expr, x)"); + + RTE_TEST_ASSERT_EQUAL( + RTE_PTR_ALIGN_FLOOR(RTE_PTR_ADD(&arr[1], 1), 4), &arr[1], + "RTE_PTR_ALIGN_FLOOR(x < y/2, y)"); + RTE_TEST_ASSERT_EQUAL( + RTE_PTR_ALIGN_FLOOR(RTE_PTR_ADD(&arr[1], 3), 4), &arr[1], + "RTE_PTR_ALIGN_FLOOR(x > y/2, y)"); + RTE_TEST_ASSERT_EQUAL( + RTE_PTR_ALIGN_CEIL(RTE_PTR_ADD(&arr[1], 3), 4), &arr[2], + "RTE_PTR_ALIGN_CEIL(x < y/2, y)"); + RTE_TEST_ASSERT_EQUAL( + RTE_PTR_ALIGN_CEIL(RTE_PTR_ADD(&arr[1], 1), 4), &arr[2], + "RTE_PTR_ALIGN_CEIL(x > y/2, y)"); + + RTE_TEST_ASSERT(strncmp(RTE_STR(test), "test", sizeof("test")) == 0, + "RTE_STR"); return 0; } diff --git a/dpdk/app/test/test_cryptodev.c b/dpdk/app/test/test_cryptodev.c index 8ad2f251e..39d97eab0 100644 --- a/dpdk/app/test/test_cryptodev.c +++ b/dpdk/app/test/test_cryptodev.c @@ -3121,6 +3121,16 @@ create_wireless_algo_auth_cipher_operation( remaining_off -= rte_pktmbuf_data_len(sgl_buf); sgl_buf = sgl_buf->next; } + + /* The last segment should be large enough to hold full digest */ + if (sgl_buf->data_len < auth_tag_len) { + rte_pktmbuf_free(sgl_buf->next); + sgl_buf->next = NULL; + TEST_ASSERT_NOT_NULL(rte_pktmbuf_append(sgl_buf, + auth_tag_len - sgl_buf->data_len), + "No room to append auth tag"); + } + sym_op->auth.digest.data = rte_pktmbuf_mtod_offset(sgl_buf, uint8_t *, remaining_off); sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(sgl_buf, @@ -6223,8 +6233,10 @@ test_snow3g_decryption_with_digest_test_case_1(void) */ snow3g_hash_test_vector_setup(&snow3g_test_case_7, &snow3g_hash_data); - return test_snow3g_decryption(&snow3g_test_case_7) & - test_snow3g_authentication_verify(&snow3g_hash_data); + if (test_snow3g_decryption(&snow3g_test_case_7)) + return TEST_FAILED; + + return test_snow3g_authentication_verify(&snow3g_hash_data); } static int @@ -7708,7 +7720,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, rte_pktmbuf_iova(ut_params->ibuf); /* Copy AAD 18 bytes after the AAD pointer, according to the API */ memcpy(sym_op->aead.aad.data + 18, tdata->aad.data, tdata->aad.len); - debug_hexdump(stdout, "aad:", sym_op->aead.aad.data, + debug_hexdump(stdout, "aad:", sym_op->aead.aad.data + 18, tdata->aad.len); /* Append IV at the end of the crypto operation*/ @@ -7717,7 +7729,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, /* Copy IV 1 byte after the IV pointer, according to the API */ rte_memcpy(iv_ptr + 1, tdata->iv.data, tdata->iv.len); - debug_hexdump(stdout, "iv:", iv_ptr, + debug_hexdump(stdout, "iv:", iv_ptr + 1, tdata->iv.len); } else { aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16); diff --git a/dpdk/app/test/test_cryptodev_asym.c b/dpdk/app/test/test_cryptodev_asym.c index 9254c1718..fd398cd90 100644 --- a/dpdk/app/test/test_cryptodev_asym.c +++ b/dpdk/app/test/test_cryptodev_asym.c @@ -207,8 +207,8 @@ queue_ops_rsa_enc_dec(struct rte_cryptodev_asym_session *sess) status = TEST_FAILED; goto error_exit; } - debug_hexdump(stdout, "encrypted message", asym_op->rsa.message.data, - asym_op->rsa.message.length); + debug_hexdump(stdout, "encrypted message", asym_op->rsa.cipher.data, + asym_op->rsa.cipher.length); /* Use the resulted output as decryption Input vector*/ asym_op = result_op->asym; diff --git a/dpdk/app/test/test_cryptodev_security_pdcp_test_vectors.h b/dpdk/app/test/test_cryptodev_security_pdcp_test_vectors.h index 703076479..3e8a8a243 100644 --- a/dpdk/app/test/test_cryptodev_security_pdcp_test_vectors.h +++ b/dpdk/app/test/test_cryptodev_security_pdcp_test_vectors.h @@ -4145,7 +4145,7 @@ static uint8_t *pdcp_test_data_in[] = { /*************** 12-bit C-plane ****************/ /* Control Plane w/NULL enc. + NULL int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4159,7 +4159,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/NULL enc. + SNOW f9 int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4173,7 +4173,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/NULL enc. + AES CMAC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4187,7 +4187,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/NULL enc. + ZUC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4202,7 +4202,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/SNOW f8 enc. + NULL int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4216,7 +4216,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/SNOW f8 enc. + SNOW f9 int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4230,7 +4230,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/SNOW f8 enc. + AES CMAC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4244,7 +4244,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/SNOW f8 enc. + ZUC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4259,7 +4259,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/AES CTR enc. + NULL int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4273,7 +4273,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/AES CTR enc. + SNOW f9 int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4287,7 +4287,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/AES CTR enc. + AES CMAC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4301,7 +4301,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/AES CTR enc. + ZUC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4316,7 +4316,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/ZUC enc. + NULL int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4330,7 +4330,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/ZUC enc. + SNOW f9 int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4344,7 +4344,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/ZUC enc. + AES CMAC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4358,7 +4358,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/ZUC enc. + ZUC int. UL */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4391,7 +4391,7 @@ static uint8_t *pdcp_test_data_in[] = { (uint8_t[]){0x8b, 0x26, 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8}, /* User Plane w/NULL enc. UL for 18-bit SN*/ - (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, + (uint8_t[]){0x80, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, @@ -4425,7 +4425,7 @@ static uint8_t *pdcp_test_data_in[] = { (uint8_t[]){0x8b, 0x26, 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8}, /* User Plane w/SNOW enc. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4459,7 +4459,7 @@ static uint8_t *pdcp_test_data_in[] = { (uint8_t[]){0x8b, 0x26, 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8}, /* User Plane w/AES enc. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4493,7 +4493,7 @@ static uint8_t *pdcp_test_data_in[] = { (uint8_t[]){0x8b, 0x26, 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8}, /* User Plane w/ZUC enc. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4511,7 +4511,7 @@ static uint8_t *pdcp_test_data_in[] = { /*************** u-plane with integrity for 12-bit SN *****/ /* User Plane w/NULL enc. + NULL int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4525,7 +4525,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/NULL enc. + SNOW f9 int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4539,7 +4539,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/NULL enc. + AES CMAC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4553,7 +4553,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/NULL enc. + ZUC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4568,7 +4568,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/SNOW f8 enc. + NULL int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4582,7 +4582,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/SNOW f8 enc. + SNOW f9 int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4596,7 +4596,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/SNOW f8 enc. + AES CMAC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4610,7 +4610,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/SNOW f8 enc. + ZUC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4625,7 +4625,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/AES CTR enc. + NULL int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4639,7 +4639,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/AES CTR enc. + SNOW f9 int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4653,7 +4653,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/AES CTR enc. + AES CMAC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4667,7 +4667,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/AES CTR enc. + ZUC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4682,7 +4682,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/ZUC enc. + NULL int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4696,7 +4696,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/ZUC enc. + SNOW f9 int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4710,7 +4710,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/ZUC enc. + AES CMAC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4724,7 +4724,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/ZUC enc. + ZUC int. UL for 12-bit SN*/ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, @@ -4740,7 +4740,7 @@ static uint8_t *pdcp_test_data_in[] = { /*************** u-plane with integrity for 18-bit SN *****/ /* User Plane w/NULL enc. + NULL int. UL for 18-bit SN*/ - (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, + (uint8_t[]){0x80, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, @@ -4756,7 +4756,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/NULL enc. + SNOW f9 int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4772,7 +4772,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/NULL enc. + AES CMAC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4788,7 +4788,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/NULL enc. + ZUC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4804,7 +4804,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/SNOW f8 enc. + NULL int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4820,7 +4820,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/SNOW f8 enc. + SNOW f9 int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4836,7 +4836,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/SNOW f8 enc. + AES CMAC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4852,7 +4852,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/SNOW f8 enc. + ZUC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4868,7 +4868,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/AES CTR enc. + NULL int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4884,7 +4884,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/AES CTR enc. + SNOW f9 int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4900,7 +4900,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/AES CTR enc. + AES CMAC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4916,7 +4916,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/AES CTR enc. + ZUC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4932,7 +4932,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/ZUC enc. + NULL int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4948,7 +4948,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/ZUC enc. + SNOW f9 int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4964,7 +4964,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/ZUC enc. + AES CMAC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -4980,7 +4980,7 @@ static uint8_t *pdcp_test_data_in[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69}, /* User Plane w/ZUC enc. + ZUC int. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, @@ -5435,7 +5435,7 @@ static uint8_t *pdcp_test_data_out[] = { /************ C-plane 12-bit ****************************/ /* Control Plane w/NULL enc. + NULL int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, @@ -5451,13 +5451,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* Control Plane w/NULL enc. + SNOW f9 int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, - 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x74, 0xB8, 0x27, 0x96}, + 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x33, 0x22, 0x02, 0x10}, /* Control Plane w/NULL enc. + SNOW f9 int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, @@ -5467,13 +5467,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x97, 0x50, 0x3F, 0xF7}, /* Control Plane w/NULL enc. + AES CMAC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, - 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x3F, 0x71, 0x26, 0x2E}, + 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x1B, 0xB0, 0x4A, 0xBF}, /* Control Plane w/NULL enc. + AES CMAC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, @@ -5483,13 +5483,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xE8, 0xBB, 0xE9, 0x36}, /* Control Plane w/NULL enc. + ZUC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x00, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, - 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x54, 0xEF, 0x25, 0xC3}, + 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x28, 0x41, 0xAB, 0x16}, /* Control Plane w/NULL enc. + ZUC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, @@ -5500,7 +5500,7 @@ static uint8_t *pdcp_test_data_out[] = { 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x76, 0xD0, 0x5B, 0x2C}, /* Control Plane w/SNOW f8 enc. + NULL int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x00, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, @@ -5516,13 +5516,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0xDC, 0x32, 0x96, 0x65}, /* Control Plane w/SNOW f8 enc. + SNOW f9 int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x00, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, 0xF7, 0xBC, 0x45, 0x2A, 0x2E, 0xB4, 0xF5, 0xD0, 0x39, 0x5B, 0x70, 0xB4, 0x53, 0x90, 0x98, 0x8A, 0x7C, 0x87, 0x21, 0xED, - 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x66, 0xBF, 0x8B, 0x05}, + 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x21, 0x25, 0xAE, 0x83}, /* Control Plane w/SNOW f8 enc. + SNOW f9 int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0xC1, 0x3A, 0x28, 0xBC, 0xEB, 0xAC, 0x49, 0xB9, 0xA1, 0xFC, 0xD6, 0x83, 0xEC, 0xA2, 0x89, 0xE6, 0x8F, 0xCA, @@ -5532,13 +5532,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0x4B, 0x62, 0xA9, 0x92}, /* Control Plane w/SNOW f8 enc. + AES CMAC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x00, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, 0xF7, 0xBC, 0x45, 0x2A, 0x2E, 0xB4, 0xF5, 0xD0, 0x39, 0x5B, 0x70, 0xB4, 0x53, 0x90, 0x98, 0x8A, 0x7C, 0x87, 0x21, 0xED, - 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x2D, 0x76, 0x8A, 0xBD}, + 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x09, 0xB7, 0xE6, 0x2C}, /* Control Plane w/SNOW f8 enc. + AES CMAC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0xC1, 0x3A, 0x28, 0xBC, 0xEB, 0xAC, 0x49, 0xB9, 0xA1, 0xFC, 0xD6, 0x83, 0xEC, 0xA2, 0x89, 0xE6, 0x8F, 0xCA, @@ -5548,13 +5548,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0x34, 0x89, 0x7F, 0x53}, /* Control Plane w/SNOW f8 enc. + ZUC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x00, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, 0xF7, 0xBC, 0x45, 0x2A, 0x2E, 0xB4, 0xF5, 0xD0, 0x39, 0x5B, 0x70, 0xB4, 0x53, 0x90, 0x98, 0x8A, 0x7C, 0x87, 0x21, 0xED, - 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x46, 0xE8, 0x89, 0x50}, + 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x3A, 0x46, 0x07, 0x85}, /* Control Plane w/SNOW f8 enc. + ZUC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0xC1, 0x3A, 0x28, 0xBC, 0xEB, 0xAC, 0x49, 0xB9, 0xA1, 0xFC, 0xD6, 0x83, 0xEC, 0xA2, 0x89, 0xE6, 0x8F, 0xCA, @@ -5565,7 +5565,7 @@ static uint8_t *pdcp_test_data_out[] = { 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0xAA, 0xE2, 0xCD, 0x49}, /* Control Plane w/AES CTR enc. + NULL int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x00, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, @@ -5582,13 +5582,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0x87, 0x7A, 0x32, 0x1B}, /* Control Plane w/AES CTR enc. + SNOW f9 int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x00, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, 0x9D, 0x56, 0xBA, 0xF7, 0x08, 0x6D, 0xC5, 0x89, 0xFB, 0xAB, 0x99, 0xD1, 0x37, 0x42, 0x89, 0x8F, 0xE1, 0xAE, 0xA3, 0x22, - 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xF2, 0x8B, 0x18, 0xAA}, + 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xB5, 0x11, 0x3D, 0x2C}, /* Control Plane w/AES CTR enc. + SNOW f9 int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x84, 0x3D, 0x5A, 0x2C, 0xBA, 0x02, 0xC1, 0x6C, @@ -5599,13 +5599,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0x10, 0x2A, 0x0D, 0xEC}, /* Control Plane w/AES CTR enc. + AES CMAC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x00, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, 0x9D, 0x56, 0xBA, 0xF7, 0x08, 0x6D, 0xC5, 0x89, 0xFB, 0xAB, 0x99, 0xD1, 0x37, 0x42, 0x89, 0x8F, 0xE1, 0xAE, 0xA3, 0x22, - 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xB9, 0x42, 0x19, 0x12}, + 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0x9D, 0x83, 0x75, 0x83}, /* Control Plane w/AES CTR enc. + AES CMAC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x84, 0x3D, 0x5A, 0x2C, 0xBA, 0x02, 0xC1, 0x6C, 0x8D, 0x78, 0xB5, 0x1F, 0x51, 0x70, 0x18, 0x61, 0x92, 0x10, @@ -5615,13 +5615,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0x6F, 0xC1, 0xDB, 0x2D}, /* Control Plane w/AES CTR enc. + ZUC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x00, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, 0x9D, 0x56, 0xBA, 0xF7, 0x08, 0x6D, 0xC5, 0x89, 0xFB, 0xAB, 0x99, 0xD1, 0x37, 0x42, 0x89, 0x8F, 0xE1, 0xAE, 0xA3, 0x22, - 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xD2, 0xDC, 0x1A, 0xFF}, + 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xAE, 0x72, 0x94, 0x2A}, /* Control Plane w/AES CTR enc. + ZUC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x84, 0x3D, 0x5A, 0x2C, 0xBA, 0x02, 0xC1, 0x6C, 0x8D, 0x78, 0xB5, 0x1F, 0x51, 0x70, 0x18, 0x61, 0x92, 0x10, @@ -5631,7 +5631,7 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0xF1, 0xAA, 0x69, 0x37}, /* Control Plane w/ZUC enc. + NULL int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x00, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, @@ -5647,13 +5647,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x85, 0xAF, 0x0A, 0xFF, 0xAC, 0x6A, 0x00, 0x19, 0xC1, 0x51, 0x53, 0xDE, 0x78, 0x07, 0x6D, 0x10, 0x90, 0xF5, 0xBD, 0x56}, /* Control Plane w/ZUC enc. + SNOW f9 int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x00, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, 0x73, 0x45, 0x51, 0x87, 0xFF, 0x64, 0xFB, 0x3C, 0xA6, 0xB5, 0xD0, 0x1C, 0xD6, 0x90, 0x3D, 0x40, 0x54, 0x22, 0x2F, 0x6C, - 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x69, 0x75, 0x1D, 0x76}, + 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x2E, 0xEF, 0x38, 0xF0}, /* Control Plane w/ZUC enc. + SNOW f9 int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x3F, 0x01, 0xCE, 0xBD, 0x8A, 0x98, 0x7B, 0x26, 0xF1, 0x28, 0x74, 0xDC, 0x26, 0x2B, 0x02, 0xE8, 0x9C, 0xBC, @@ -5663,13 +5663,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x85, 0xAF, 0x0A, 0xFF, 0xAC, 0x6A, 0x00, 0x19, 0xC1, 0x51, 0x53, 0xDE, 0x78, 0x07, 0x6D, 0x10, 0x07, 0xA5, 0x82, 0xA1}, /* Control Plane w/ZUC enc. + AES CMAC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x00, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, 0x73, 0x45, 0x51, 0x87, 0xFF, 0x64, 0xFB, 0x3C, 0xA6, 0xB5, 0xD0, 0x1C, 0xD6, 0x90, 0x3D, 0x40, 0x54, 0x22, 0x2F, 0x6C, - 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x22, 0xBC, 0x1C, 0xCE}, + 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x06, 0x7D, 0x70, 0x5F}, /* Control Plane w/ZUC enc. + AES CMAC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x3F, 0x01, 0xCE, 0xBD, 0x8A, 0x98, 0x7B, 0x26, 0xF1, 0x28, 0x74, 0xDC, 0x26, 0x2B, 0x02, 0xE8, 0x9C, 0xBC, @@ -5679,13 +5679,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x85, 0xAF, 0x0A, 0xFF, 0xAC, 0x6A, 0x00, 0x19, 0xC1, 0x51, 0x53, 0xDE, 0x78, 0x07, 0x6D, 0x10, 0x78, 0x4E, 0x54, 0x60}, /* Control Plane w/ZUC enc. + ZUC int. UL LONG SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x00, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, 0x73, 0x45, 0x51, 0x87, 0xFF, 0x64, 0xFB, 0x3C, 0xA6, 0xB5, 0xD0, 0x1C, 0xD6, 0x90, 0x3D, 0x40, 0x54, 0x22, 0x2F, 0x6C, - 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x49, 0x22, 0x1F, 0x23}, + 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x35, 0x8C, 0x91, 0xF6}, /* Control Plane w/ZUC enc. + ZUC int. DL LONG SN */ (uint8_t[]){0xA0, 0x00, 0x3F, 0x01, 0xCE, 0xBD, 0x8A, 0x98, 0x7B, 0x26, 0xF1, 0x28, 0x74, 0xDC, 0x26, 0x2B, 0x02, 0xE8, 0x9C, 0xBC, @@ -5714,7 +5714,7 @@ static uint8_t *pdcp_test_data_out[] = { (uint8_t[]){0x8b, 0x26, 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8}, /* User Plane w/NULL enc. UL for 18-bit SN*/ - (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, + (uint8_t[]){0x80, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, @@ -5748,7 +5748,7 @@ static uint8_t *pdcp_test_data_out[] = { (uint8_t[]){0x8b, 0x26, 0x0b, 0x50, 0xf3, 0xff, 0x37, 0xe3, 0x6b, 0xaf, 0x08, 0xd8, 0xf6, 0x1f, 0xca, 0x6f, 0xbc}, /* User Plane w/SNOW enc. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, + (uint8_t[]){0x80, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, 0xCF, 0xBB, 0x8A, 0x2C, 0xB7, 0x57, 0xB6, 0x27, 0x89, 0x0D, 0x91, 0x03, 0x2C, 0x2B, 0x8D, 0x29, 0x4A, 0xBD, 0x8D, 0x48, 0xD2, 0x69, 0x37, 0xB1, 0xA1, 0x97, 0x12, 0xBD, 0x0A, 0x91, 0x4D, 0xEB, 0x76, @@ -5781,7 +5781,7 @@ static uint8_t *pdcp_test_data_out[] = { (uint8_t[]){0x8b, 0x26, 0xc7, 0xf2, 0x23, 0xb3, 0xbe, 0xc0, 0xdf, 0xc5, 0xed, 0x37, 0x35, 0x7c, 0x66, 0xa3, 0xf9}, /* User Plane w/AES enc. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, + (uint8_t[]){0x80, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, 0xF1, 0x90, 0xC2, 0x22, 0xD0, 0xD2, 0x3D, 0x44, 0x75, 0x7F, 0xC5, 0x0F, 0xAC, 0x7C, 0x18, 0x46, 0xA5, 0x3E, 0x2F, 0x0F, 0x26, 0x9E, 0x5A, 0x49, 0xF7, 0xCB, 0x70, 0x17, 0xBC, 0x01, 0x1D, 0xA3, 0x65, 0x0E, 0x4B, 0x53, @@ -5813,7 +5813,7 @@ static uint8_t *pdcp_test_data_out[] = { (uint8_t[]){0x8b, 0x26, 0xa3, 0x1a, 0x1e, 0x22, 0xf7, 0x17, 0x8a, 0xb5, 0x59, 0xd8, 0x2b, 0x13, 0xdd, 0x12, 0x4e}, /* User Plane w/ZUC enc. UL for 18-bit SN*/ - (uint8_t[]){0x0C, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, + (uint8_t[]){0x80, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, 0x74, 0xC2, 0xD7, 0xFF, 0x74, 0x59, 0x3A, 0x69, 0xD1, 0x8B, 0x65, 0x98, 0xB9, 0x3C, 0xFB, 0x63, 0xB1, 0x9E, 0xB7, 0xCA, 0x04, 0x68, 0xB9, 0xAB, 0xA2, 0x5A, 0xAF, 0x15, 0x8E, 0x71, 0xED, 0xE4, 0xFA, 0x99, 0x79, 0xF9, @@ -5829,7 +5829,7 @@ static uint8_t *pdcp_test_data_out[] = { /************************* 12-bit u-plane with int ************/ /* User Plane w/NULL enc. + NULL int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, @@ -5845,13 +5845,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD}, /* User Plane w/NULL enc. + SNOW f9 int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, - 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x74, 0xB8, 0x27, 0x96}, + 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x6A, 0x4D, 0xA1, 0xE0}, /* User Plane w/NULL enc. + SNOW f9 int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, @@ -5861,13 +5861,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x97, 0x50, 0x3F, 0xF7}, /* User Plane w/NULL enc. + AES CMAC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, - 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x3F, 0x71, 0x26, 0x2E}, + 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xB4, 0x36, 0x24, 0x75}, /* User Plane w/NULL enc. + AES CMAC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, @@ -5877,13 +5877,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xE8, 0xBB, 0xE9, 0x36}, /* User Plane w/NULL enc. + ZUC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, + (uint8_t[]){0x80, 0x01, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, 0x47, 0x0E, 0x8F, 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, - 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x54, 0xEF, 0x25, 0xC3}, + 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x5B, 0x05, 0x40, 0x0B}, /* User Plane w/NULL enc. + ZUC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x86, 0xB8, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, @@ -5894,7 +5894,7 @@ static uint8_t *pdcp_test_data_out[] = { 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0x76, 0xD0, 0x5B, 0x2C}, /* User Plane w/SNOW f8 enc. + NULL int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x80, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, @@ -5910,13 +5910,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0xDC, 0x32, 0x96, 0x65}, /* User Plane w/SNOW f8 enc. + SNOW f9 int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x80, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, 0xF7, 0xBC, 0x45, 0x2A, 0x2E, 0xB4, 0xF5, 0xD0, 0x39, 0x5B, 0x70, 0xB4, 0x53, 0x90, 0x98, 0x8A, 0x7C, 0x87, 0x21, 0xED, - 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x66, 0xBF, 0x8B, 0x05}, + 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x78, 0x4A, 0x0D, 0x73}, /* User Plane w/SNOW f8 enc. + SNOW f9 int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0xC1, 0x3A, 0x28, 0xBC, 0xEB, 0xAC, 0x49, 0xB9, 0xA1, 0xFC, 0xD6, 0x83, 0xEC, 0xA2, 0x89, 0xE6, 0x8F, 0xCA, @@ -5926,13 +5926,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0x4B, 0x62, 0xA9, 0x92}, /* User Plane w/SNOW f8 enc. + AES CMAC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x80, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, 0xF7, 0xBC, 0x45, 0x2A, 0x2E, 0xB4, 0xF5, 0xD0, 0x39, 0x5B, 0x70, 0xB4, 0x53, 0x90, 0x98, 0x8A, 0x7C, 0x87, 0x21, 0xED, - 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x2D, 0x76, 0x8A, 0xBD}, + 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0xA6, 0x31, 0x88, 0xE6}, /* User Plane w/SNOW f8 enc. + AES CMAC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0xC1, 0x3A, 0x28, 0xBC, 0xEB, 0xAC, 0x49, 0xB9, 0xA1, 0xFC, 0xD6, 0x83, 0xEC, 0xA2, 0x89, 0xE6, 0x8F, 0xCA, @@ -5942,13 +5942,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0x34, 0x89, 0x7F, 0x53}, /* User Plane w/SNOW f8 enc. + ZUC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, + (uint8_t[]){0x80, 0x01, 0xD6, 0xCC, 0xB5, 0xCE, 0x7C, 0xF8, 0xBE, 0x68, 0x2B, 0xAB, 0xC7, 0x32, 0xDA, 0x49, 0xD0, 0xC7, 0x54, 0xCA, 0x18, 0xBB, 0x05, 0x6D, 0xC5, 0x5F, 0xD3, 0xA7, 0xE6, 0xD8, 0xE1, 0xDF, 0x7C, 0x4F, 0x3C, 0x8B, 0x86, 0xC6, 0x8E, 0x24, 0xF7, 0xBC, 0x45, 0x2A, 0x2E, 0xB4, 0xF5, 0xD0, 0x39, 0x5B, 0x70, 0xB4, 0x53, 0x90, 0x98, 0x8A, 0x7C, 0x87, 0x21, 0xED, - 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x46, 0xE8, 0x89, 0x50}, + 0x76, 0x83, 0x63, 0x39, 0x2C, 0xDB, 0x49, 0x02, 0xEC, 0x98}, /* User Plane w/SNOW f8 enc. + ZUC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0xC1, 0x3A, 0x28, 0xBC, 0xEB, 0xAC, 0x49, 0xB9, 0xA1, 0xFC, 0xD6, 0x83, 0xEC, 0xA2, 0x89, 0xE6, 0x8F, 0xCA, @@ -5958,7 +5958,7 @@ static uint8_t *pdcp_test_data_out[] = { 0x0F, 0xD8, 0x38, 0xE6, 0x3F, 0xD4, 0x59, 0x7A, 0x9A, 0xB7, 0xF4, 0x52, 0xC6, 0x66, 0xC2, 0x73, 0xAA, 0xE2, 0xCD, 0x49}, /* User Plane w/AES CTR enc. + NULL int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x80, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, @@ -5975,13 +5975,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0x87, 0x7A, 0x32, 0x1B}, /* User Plane w/AES CTR enc. + SNOW f9 int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x80, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, 0x9D, 0x56, 0xBA, 0xF7, 0x08, 0x6D, 0xC5, 0x89, 0xFB, 0xAB, 0x99, 0xD1, 0x37, 0x42, 0x89, 0x8F, 0xE1, 0xAE, 0xA3, 0x22, - 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xF2, 0x8B, 0x18, 0xAA}, + 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xEC, 0x7E, 0x9E, 0xDC}, /* User Plane w/AES CTR enc. + SNOW f9 int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x84, 0x3D, 0x5A, 0x2C, 0xBA, 0x02, 0xC1, 0x6C, @@ -5992,13 +5992,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0x10, 0x2A, 0x0D, 0xEC}, /* User Plane w/AES CTR enc. + AES CMAC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x80, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, 0x9D, 0x56, 0xBA, 0xF7, 0x08, 0x6D, 0xC5, 0x89, 0xFB, 0xAB, 0x99, 0xD1, 0x37, 0x42, 0x89, 0x8F, 0xE1, 0xAE, 0xA3, 0x22, - 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xB9, 0x42, 0x19, 0x12}, + 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0x32, 0x05, 0x1B, 0x49}, /* User Plane w/AES CTR enc. + AES CMAC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x84, 0x3D, 0x5A, 0x2C, 0xBA, 0x02, 0xC1, 0x6C, 0x8D, 0x78, 0xB5, 0x1F, 0x51, 0x70, 0x18, 0x61, 0x92, 0x10, @@ -6008,13 +6008,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x7E, 0xF5, 0xBD, 0x60, 0xEB, 0x9E, 0xC2, 0xC9, 0x54, 0x65, 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0x6F, 0xC1, 0xDB, 0x2D}, /* User Plane w/AES CTR enc. + ZUC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, + (uint8_t[]){0x80, 0x01, 0x57, 0xB2, 0x7E, 0x21, 0xE7, 0xDD, 0x56, 0xCF, 0xE9, 0x97, 0x27, 0xE8, 0xA3, 0xDE, 0x4C, 0xF6, 0xD1, 0x10, 0x4A, 0x7D, 0xC0, 0xD0, 0xF7, 0x1B, 0x3E, 0x16, 0xF0, 0xA8, 0x4F, 0xBC, 0x17, 0x73, 0x9A, 0x69, 0x73, 0x6C, 0x83, 0xE5, 0x9D, 0x56, 0xBA, 0xF7, 0x08, 0x6D, 0xC5, 0x89, 0xFB, 0xAB, 0x99, 0xD1, 0x37, 0x42, 0x89, 0x8F, 0xE1, 0xAE, 0xA3, 0x22, - 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xD2, 0xDC, 0x1A, 0xFF}, + 0x60, 0x98, 0xFD, 0x79, 0x32, 0xDB, 0xDD, 0x36, 0x7F, 0x37}, /* User Plane w/AES CTR enc. + ZUC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x84, 0x3D, 0x5A, 0x2C, 0xBA, 0x02, 0xC1, 0x6C, 0x8D, 0x78, 0xB5, 0x1F, 0x51, 0x70, 0x18, 0x61, 0x92, 0x10, @@ -6025,7 +6025,7 @@ static uint8_t *pdcp_test_data_out[] = { 0x7D, 0xAC, 0xB6, 0x47, 0xFF, 0x1C, 0xF1, 0xAA, 0x69, 0x37}, /* User Plane w/ZUC enc. + NULL int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x80, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, @@ -6041,13 +6041,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x85, 0xAF, 0x0A, 0xFF, 0xAC, 0x6A, 0x00, 0x19, 0xC1, 0x51, 0x53, 0xDE, 0x78, 0x07, 0x6D, 0x10, 0x90, 0xF5, 0xBD, 0x56}, /* User Plane w/ZUC enc. + SNOW f9 int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x80, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, 0x73, 0x45, 0x51, 0x87, 0xFF, 0x64, 0xFB, 0x3C, 0xA6, 0xB5, 0xD0, 0x1C, 0xD6, 0x90, 0x3D, 0x40, 0x54, 0x22, 0x2F, 0x6C, - 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x69, 0x75, 0x1D, 0x76}, + 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x77, 0x80, 0x9B, 0x00}, /* User Plane w/ZUC enc. + SNOW f9 int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x3F, 0x01, 0xCE, 0xBD, 0x8A, 0x98, 0x7B, 0x26, 0xF1, 0x28, 0x74, 0xDC, 0x26, 0x2B, 0x02, 0xE8, 0x9C, 0xBC, @@ -6057,13 +6057,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x85, 0xAF, 0x0A, 0xFF, 0xAC, 0x6A, 0x00, 0x19, 0xC1, 0x51, 0x53, 0xDE, 0x78, 0x07, 0x6D, 0x10, 0x07, 0xA5, 0x82, 0xA1}, /* User Plane w/ZUC enc. + AES CMAC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x80, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, 0x73, 0x45, 0x51, 0x87, 0xFF, 0x64, 0xFB, 0x3C, 0xA6, 0xB5, 0xD0, 0x1C, 0xD6, 0x90, 0x3D, 0x40, 0x54, 0x22, 0x2F, 0x6C, - 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x22, 0xBC, 0x1C, 0xCE}, + 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0xA9, 0xFB, 0x1E, 0x95}, /* User Plane w/ZUC enc. + AES CMAC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x3F, 0x01, 0xCE, 0xBD, 0x8A, 0x98, 0x7B, 0x26, 0xF1, 0x28, 0x74, 0xDC, 0x26, 0x2B, 0x02, 0xE8, 0x9C, 0xBC, @@ -6073,13 +6073,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x85, 0xAF, 0x0A, 0xFF, 0xAC, 0x6A, 0x00, 0x19, 0xC1, 0x51, 0x53, 0xDE, 0x78, 0x07, 0x6D, 0x10, 0x78, 0x4E, 0x54, 0x60}, /* User Plane w/ZUC enc. + ZUC int. UL for 12-bit SN */ - (uint8_t[]){0x50, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, + (uint8_t[]){0x80, 0x01, 0x47, 0x9B, 0x21, 0xD1, 0xB2, 0x99, 0x23, 0x56, 0xC5, 0xFF, 0xC2, 0xB7, 0x7D, 0x30, 0xBA, 0xFB, 0x43, 0xED, 0x79, 0xC9, 0x9D, 0x9D, 0x38, 0x35, 0xC6, 0x7B, 0xD0, 0xAA, 0x33, 0x08, 0x88, 0x72, 0x16, 0x1D, 0xF7, 0xA0, 0xD9, 0xEC, 0x73, 0x45, 0x51, 0x87, 0xFF, 0x64, 0xFB, 0x3C, 0xA6, 0xB5, 0xD0, 0x1C, 0xD6, 0x90, 0x3D, 0x40, 0x54, 0x22, 0x2F, 0x6C, - 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x49, 0x22, 0x1F, 0x23}, + 0xE4, 0xB1, 0x71, 0x15, 0x78, 0x54, 0x46, 0xC8, 0x7A, 0xEB}, /* User Plane w/ZUC enc. + ZUC int. DL for 12-bit SN */ (uint8_t[]){0xA0, 0x00, 0x3F, 0x01, 0xCE, 0xBD, 0x8A, 0x98, 0x7B, 0x26, 0xF1, 0x28, 0x74, 0xDC, 0x26, 0x2B, 0x02, 0xE8, 0x9C, 0xBC, @@ -6091,7 +6091,7 @@ static uint8_t *pdcp_test_data_out[] = { /************************* 18-bit u-plane with int ************/ /* User Plane w/NULL enc. + NULL int. UL for 18-bit SN */ - (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, + (uint8_t[]){0x80, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, 0x64, 0xD3, 0x5E, 0xAF, 0x3F, 0x57, 0xC2, 0xE2, 0x91, 0x91, 0xA3, 0x9C, 0xE6, 0x30, 0x69, 0x70, 0x33, 0x8A, 0x15, 0xD0, 0x36, @@ -6107,13 +6107,13 @@ static uint8_t *pdcp_test_data_out[] = { 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69, 0x00, 0x00, 0x00, 0x00}, /* User Plane w/NULL enc. + SNOW f9 int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, 0x31, 0xA2, 0x76, 0xBA, 0xFC, 0x5A, 0xDB, 0xAA, 0xA3, 0x0B, 0x6A, 0xD2, 0xEE, 0xD6, 0x93, 0xE4, 0x1B, 0x11, 0x4F, 0xC4, 0xD7, 0xDA, - 0x91, 0x7F, 0x71, 0x17, 0x69}, + 0x91, 0x7F, 0x58, 0x24, 0x17}, /* User Plane w/NULL enc. + SNOW f9 int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, @@ -6122,12 +6122,12 @@ static uint8_t *pdcp_test_data_out[] = { 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69, 0x84, 0x45, 0xA8, 0x88}, /* User Plane w/NULL enc. + AES CMAC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, 0x31, 0xA2, 0x76, 0xBA, 0xFC, 0x5A, 0xDB, 0xAA, 0xA3, 0x0B, 0x6A, 0xD2, 0xEE, 0xD6, 0x93, - 0xE4, 0x1B, 0x11, 0x4F, 0xC4, 0xD7, 0xDA, 0x91, 0x33, 0x9B, 0x38, 0xF7}, + 0xE4, 0x1B, 0x11, 0x4F, 0xC4, 0xD7, 0xDA, 0x91, 0x83, 0xB7, 0xF2, 0x0B}, /* User Plane w/NULL enc. + AES CMAC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, @@ -6136,12 +6136,12 @@ static uint8_t *pdcp_test_data_out[] = { 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69, 0xD9, 0x0B, 0x89, 0x7F}, /* User Plane w/NULL enc. + ZUC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, + (uint8_t[]){0x80, 0x00, 0x01, 0xB8, 0x33, 0x4F, 0x85, 0x8C, 0x2C, 0x65, 0x7D, 0x8F, 0x5D, 0x40, 0x57, 0x60, 0x52, 0x4F, 0xB9, 0xF1, 0x69, 0xE9, 0x68, 0x04, 0xFC, 0x7A, 0xBE, 0xD2, 0x5B, 0x4A, 0x21, 0x7F, 0x13, 0x52, 0x08, 0xBA, 0xBD, 0x69, 0x51, 0xC9, 0x63, 0xCF, 0x06, 0x62, 0x31, 0xA2, 0x76, 0xBA, 0xFC, 0x5A, 0xDB, 0xAA, 0xA3, 0x0B, 0x6A, 0xD2, 0xEE, 0xD6, 0x93, - 0xE4, 0x1B, 0x11, 0x4F, 0xC4, 0xD7, 0xDA, 0x91, 0xB5, 0xD9, 0x5D, 0xE0}, + 0xE4, 0x1B, 0x11, 0x4F, 0xC4, 0xD7, 0xDA, 0x91, 0xAB, 0x98, 0xC0, 0x1A}, /* User Plane w/NULL enc. + ZUC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0xF8, 0xDB, 0x2D, 0x3F, 0x23, 0x82, 0x53, 0xFD, 0x37, 0xDE, 0x88, 0x63, 0x08, 0x4F, 0xD3, 0x71, 0xFB, 0xEB, 0x35, 0xF3, @@ -6150,7 +6150,7 @@ static uint8_t *pdcp_test_data_out[] = { 0xEE, 0x2C, 0x96, 0x0C, 0xD7, 0x7D, 0x70, 0x1B, 0x01, 0x7F, 0x96, 0x46, 0x53, 0xB0, 0xA4, 0x7A, 0xF9, 0xDD, 0xCC, 0x69, 0xDA, 0xE9, 0x17, 0x96}, /* User Plane w/SNOW f8 enc. + NULL int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, + (uint8_t[]){0x80, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, 0xCF, 0xBB, 0x8A, 0x2C, 0xB7, 0x57, 0xB6, 0x27, 0x89, 0x0D, 0x91, 0x03, 0x2C, 0x2B, 0x8D, 0x29, 0x4A, 0xBD, 0x8D, 0x48, 0xD2, 0x69, 0x37, 0xB1, 0xA1, 0x97, 0x12, 0xBD, 0x0A, 0x91, 0x4D, 0xEB, 0x76, @@ -6165,12 +6165,12 @@ static uint8_t *pdcp_test_data_out[] = { 0xC4, 0xB0, 0xB8, 0x31, 0x50, 0x9E, 0x37, 0x15, 0x0E, 0x0D, 0x29, 0x9D, 0xB3, 0x78, 0xFB, 0x9D, 0x5C, 0x90, 0xF8, 0x80, 0x53, 0x93, 0xEF, 0x7C}, /* User Plane w/SNOW f8 enc. + SNOW f9 int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, + (uint8_t[]){0x80, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, 0xCF, 0xBB, 0x8A, 0x2C, 0xB7, 0x57, 0xB6, 0x27, 0x89, 0x0D, 0x91, 0x03, 0x2C, 0x2B, 0x8D, 0x29, 0x4A, 0xBD, 0x8D, 0x48, 0xD2, 0x69, 0x37, 0xB1, 0xA1, 0x97, 0x12, 0xBD, 0x0A, 0x91, 0x4D, 0xEB, 0x76, 0xC8, 0x96, 0x7A, 0x0A, 0x25, 0x08, 0xEB, 0x41, 0x30, 0x00, 0x33, 0xC7, 0xFF, 0x33, 0x4E, - 0xC1, 0xFE, 0x5C, 0x0F, 0x15, 0xE7, 0x9F, 0x31, 0x2A, 0xAB, 0x0F, 0x24}, + 0xC1, 0xFE, 0x5C, 0x0F, 0x15, 0xE7, 0x9F, 0x31, 0x2A, 0x82, 0x3C, 0x5A}, /* User Plane w/SNOW f8 enc. + SNOW f9 int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x22, 0x2D, 0x15, 0xBA, 0x95, 0xAC, 0x47, 0x5A, 0xE3, 0x90, 0x82, 0xEA, 0xC2, 0x93, 0x80, 0x23, 0xE9, 0xAC, 0xEA, 0x5D, @@ -6179,12 +6179,12 @@ static uint8_t *pdcp_test_data_out[] = { 0xC4, 0xB0, 0xB8, 0x31, 0x50, 0x9E, 0x37, 0x15, 0x0E, 0x0D, 0x29, 0x9D, 0xB3, 0x78, 0xFB, 0x9D, 0x5C, 0x90, 0xF8, 0x80, 0xD7, 0xD6, 0x47, 0xF4}, /* User Plane w/SNOW f8 enc. + AES CMAC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, + (uint8_t[]){0x80, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, 0xCF, 0xBB, 0x8A, 0x2C, 0xB7, 0x57, 0xB6, 0x27, 0x89, 0x0D, 0x91, 0x03, 0x2C, 0x2B, 0x8D, 0x29, 0x4A, 0xBD, 0x8D, 0x48, 0xD2, 0x69, 0x37, 0xB1, 0xA1, 0x97, 0x12, 0xBD, 0x0A, 0x91, 0x4D, 0xEB, 0x76, 0xC8, 0x96, 0x7A, 0x0A, 0x25, 0x08, 0xEB, 0x41, 0x30, 0x00, 0x33, 0xC7, 0xFF, 0x33, 0x4E, - 0xC1, 0xFE, 0x5C, 0x0F, 0x15, 0xE7, 0x9F, 0x31, 0x66, 0x41, 0x20, 0xBA}, + 0xC1, 0xFE, 0x5C, 0x0F, 0x15, 0xE7, 0x9F, 0x31, 0xD6, 0x6D, 0xEA, 0x46}, /* User Plane w/SNOW f8 enc. + AES CMAC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x22, 0x2D, 0x15, 0xBA, 0x95, 0xAC, 0x47, 0x5A, 0xE3, 0x90, 0x82, 0xEA, 0xC2, 0x93, 0x80, 0x23, 0xE9, 0xAC, 0xEA, 0x5D, @@ -6193,12 +6193,12 @@ static uint8_t *pdcp_test_data_out[] = { 0xC4, 0xB0, 0xB8, 0x31, 0x50, 0x9E, 0x37, 0x15, 0x0E, 0x0D, 0x29, 0x9D, 0xB3, 0x78, 0xFB, 0x9D, 0x5C, 0x90, 0xF8, 0x80, 0x8A, 0x98, 0x66, 0x03}, /* User Plane w/SNOW f8 enc. + ZUC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, + (uint8_t[]){0x80, 0x00, 0x01, 0x9A, 0xAF, 0x1D, 0x21, 0x2F, 0x48, 0xB2, 0x30, 0xCF, 0xBB, 0x8A, 0x2C, 0xB7, 0x57, 0xB6, 0x27, 0x89, 0x0D, 0x91, 0x03, 0x2C, 0x2B, 0x8D, 0x29, 0x4A, 0xBD, 0x8D, 0x48, 0xD2, 0x69, 0x37, 0xB1, 0xA1, 0x97, 0x12, 0xBD, 0x0A, 0x91, 0x4D, 0xEB, 0x76, 0xC8, 0x96, 0x7A, 0x0A, 0x25, 0x08, 0xEB, 0x41, 0x30, 0x00, 0x33, 0xC7, 0xFF, 0x33, 0x4E, - 0xC1, 0xFE, 0x5C, 0x0F, 0x15, 0xE7, 0x9F, 0x31, 0xE0, 0x03, 0x45, 0xAD}, + 0xC1, 0xFE, 0x5C, 0x0F, 0x15, 0xE7, 0x9F, 0x31, 0xFE, 0x42, 0xD8, 0x57}, /* User Plane w/SNOW f8 enc. + ZUC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x22, 0x2D, 0x15, 0xBA, 0x95, 0xAC, 0x47, 0x5A, 0xE3, 0x90, 0x82, 0xEA, 0xC2, 0x93, 0x80, 0x23, 0xE9, 0xAC, 0xEA, 0x5D, @@ -6207,7 +6207,7 @@ static uint8_t *pdcp_test_data_out[] = { 0xC4, 0xB0, 0xB8, 0x31, 0x50, 0x9E, 0x37, 0x15, 0x0E, 0x0D, 0x29, 0x9D, 0xB3, 0x78, 0xFB, 0x9D, 0x5C, 0x90, 0xF8, 0x80, 0x89, 0x7A, 0xF8, 0xEA}, /* User Plane w/AES CTR enc. + NULL int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, + (uint8_t[]){0x80, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, 0xF1, 0x90, 0xC2, 0x22, 0xD0, 0xD2, 0x3D, 0x44, 0x75, 0x7F, 0xC5, 0x0F, 0xAC, 0x7C, 0x18, 0x46, 0xA5, 0x3E, 0x2F, 0x0F, 0x26, 0x9E, 0x5A, 0x49, 0xF7, 0xCB, 0x70, 0x17, 0xBC, 0x01, 0x1D, 0xA3, 0x65, 0x0E, 0x4B, 0x53, @@ -6221,12 +6221,12 @@ static uint8_t *pdcp_test_data_out[] = { 0x39, 0x22, 0xB2, 0xF6, 0x5F, 0xBD, 0x58, 0xE3, 0xE0, 0xDB, 0xD5, 0x7F, 0xFB, 0x78, 0x95, 0xE1, 0x5E, 0x36, 0xF8, 0x52, 0x98, 0x15, 0x68, 0x35}, /* User Plane w/AES CTR enc. + SNOW f9 int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, + (uint8_t[]){0x80, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, 0xF1, 0x90, 0xC2, 0x22, 0xD0, 0xD2, 0x3D, 0x44, 0x75, 0x7F, 0xC5, 0x0F, 0xAC, 0x7C, 0x18, 0x46, 0xA5, 0x3E, 0x2F, 0x0F, 0x26, 0x9E, 0x5A, 0x49, 0xF7, 0xCB, 0x70, 0x17, 0xBC, 0x01, 0x1D, 0xA3, 0x65, 0x0E, 0x4B, 0x53, 0x14, 0x73, 0x76, 0xDE, 0x54, 0xA0, 0xF9, 0x4C, 0xC2, 0x8F, 0x02, 0x88, - 0x36, 0xC7, 0xC4, 0x5A, 0x57, 0x7D, 0xA1, 0x0D, 0xBE, 0x17, 0x81, 0xA1}, + 0x36, 0xC7, 0xC4, 0x5A, 0x57, 0x7D, 0xA1, 0x0D, 0xBE, 0x3E, 0xB2, 0xDF}, /* User Plane w/AES CTR enc. + SNOW f9 int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x01, 0x0D, 0x4B, 0x5E, 0xD3, 0xCE, 0x96, 0xE1, 0x9A, 0x9D, 0xB3, 0x01, 0xD6, 0x40, 0x50, 0x00, 0x6C, 0x63, 0xFD, 0x37, @@ -6235,12 +6235,12 @@ static uint8_t *pdcp_test_data_out[] = { 0x39, 0x22, 0xB2, 0xF6, 0x5F, 0xBD, 0x58, 0xE3, 0xE0, 0xDB, 0xD5, 0x7F, 0xFB, 0x78, 0x95, 0xE1, 0x5E, 0x36, 0xF8, 0x52, 0x1C, 0x50, 0xC0, 0xBD}, /* User Plane w/AES CTR enc. + AES CMAC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, + (uint8_t[]){0x80, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, 0xF1, 0x90, 0xC2, 0x22, 0xD0, 0xD2, 0x3D, 0x44, 0x75, 0x7F, 0xC5, 0x0F, 0xAC, 0x7C, 0x18, 0x46, 0xA5, 0x3E, 0x2F, 0x0F, 0x26, 0x9E, 0x5A, 0x49, 0xF7, 0xCB, 0x70, 0x17, 0xBC, 0x01, 0x1D, 0xA3, 0x65, 0x0E, 0x4B, 0x53, 0x14, 0x73, 0x76, 0xDE, 0x54, 0xA0, 0xF9, 0x4C, 0xC2, 0x8F, 0x02, 0x88, - 0x36, 0xC7, 0xC4, 0x5A, 0x57, 0x7D, 0xA1, 0x0D, 0xF2, 0xFD, 0xAE, 0x3F}, + 0x36, 0xC7, 0xC4, 0x5A, 0x57, 0x7D, 0xA1, 0x0D, 0x42, 0xD1, 0x64, 0xC3}, /* User Plane w/AES CTR enc. + AES CMAC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x01, 0x0D, 0x4B, 0x5E, 0xD3, 0xCE, 0x96, 0xE1, 0x9A, 0x9D, 0xB3, 0x01, 0xD6, 0x40, 0x50, 0x00, 0x6C, 0x63, 0xFD, 0x37, @@ -6249,12 +6249,12 @@ static uint8_t *pdcp_test_data_out[] = { 0x39, 0x22, 0xB2, 0xF6, 0x5F, 0xBD, 0x58, 0xE3, 0xE0, 0xDB, 0xD5, 0x7F, 0xFB, 0x78, 0x95, 0xE1, 0x5E, 0x36, 0xF8, 0x52, 0x41, 0x1E, 0xE1, 0x4A}, /* User Plane w/AES CTR enc. + ZUC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, + (uint8_t[]){0x80, 0x00, 0x01, 0xBF, 0x31, 0x94, 0xCF, 0x6E, 0x99, 0x84, 0x08, 0xF1, 0x90, 0xC2, 0x22, 0xD0, 0xD2, 0x3D, 0x44, 0x75, 0x7F, 0xC5, 0x0F, 0xAC, 0x7C, 0x18, 0x46, 0xA5, 0x3E, 0x2F, 0x0F, 0x26, 0x9E, 0x5A, 0x49, 0xF7, 0xCB, 0x70, 0x17, 0xBC, 0x01, 0x1D, 0xA3, 0x65, 0x0E, 0x4B, 0x53, 0x14, 0x73, 0x76, 0xDE, 0x54, 0xA0, 0xF9, 0x4C, 0xC2, 0x8F, 0x02, 0x88, - 0x36, 0xC7, 0xC4, 0x5A, 0x57, 0x7D, 0xA1, 0x0D, 0x74, 0xBF, 0xCB, 0x28}, + 0x36, 0xC7, 0xC4, 0x5A, 0x57, 0x7D, 0xA1, 0x0D, 0x6A, 0xFE, 0x56, 0xD2}, /* User Plane w/AES CTR enc. + ZUC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x01, 0x0D, 0x4B, 0x5E, 0xD3, 0xCE, 0x96, 0xE1, 0x9A, 0x9D, 0xB3, 0x01, 0xD6, 0x40, 0x50, 0x00, 0x6C, 0x63, 0xFD, 0x37, @@ -6263,7 +6263,7 @@ static uint8_t *pdcp_test_data_out[] = { 0x39, 0x22, 0xB2, 0xF6, 0x5F, 0xBD, 0x58, 0xE3, 0xE0, 0xDB, 0xD5, 0x7F, 0xFB, 0x78, 0x95, 0xE1, 0x5E, 0x36, 0xF8, 0x52, 0x42, 0xFC, 0x7F, 0xA3}, /* User Plane w/ZUC enc. + NULL int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, + (uint8_t[]){0x80, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, 0x74, 0xC2, 0xD7, 0xFF, 0x74, 0x59, 0x3A, 0x69, 0xD1, 0x8B, 0x65, 0x98, 0xB9, 0x3C, 0xFB, 0x63, 0xB1, 0x9E, 0xB7, 0xCA, 0x04, 0x68, 0xB9, 0xAB, 0xA2, 0x5A, 0xAF, 0x15, 0x8E, 0x71, 0xED, 0xE4, 0xFA, 0x99, 0x79, 0xF9, @@ -6277,12 +6277,12 @@ static uint8_t *pdcp_test_data_out[] = { 0x7D, 0x2D, 0xE0, 0x3C, 0xE3, 0x81, 0xAA, 0xEA, 0xCC, 0xD7, 0xFC, 0x46, 0x07, 0x7C, 0x8E, 0x8E, 0x0E, 0x99, 0xB8, 0x31, 0x65, 0x17, 0xF6, 0xE3}, /* User Plane w/ZUC enc. + SNOW f9 int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, + (uint8_t[]){0x80, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, 0x74, 0xC2, 0xD7, 0xFF, 0x74, 0x59, 0x3A, 0x69, 0xD1, 0x8B, 0x65, 0x98, 0xB9, 0x3C, 0xFB, 0x63, 0xB1, 0x9E, 0xB7, 0xCA, 0x04, 0x68, 0xB9, 0xAB, 0xA2, 0x5A, 0xAF, 0x15, 0x8E, 0x71, 0xED, 0xE4, 0xFA, 0x99, 0x79, 0xF9, 0x51, 0x54, 0x82, 0x69, 0x4C, 0x45, 0x0B, 0xFA, 0x87, 0x4D, 0x97, 0x6E, - 0xB0, 0xC9, 0x06, 0x08, 0x6B, 0xFC, 0x4A, 0x85, 0x3C, 0x13, 0x64, 0xB1}, + 0xB0, 0xC9, 0x06, 0x08, 0x6B, 0xFC, 0x4A, 0x85, 0x3C, 0x3A, 0x57, 0xCF}, /* User Plane w/ZUC enc. + SNOW f9 int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x30, 0x62, 0x48, 0xC0, 0xB1, 0xED, 0x1F, 0x13, 0x8A, 0x7A, 0x62, 0x40, 0x12, 0x35, 0x54, 0x03, 0x93, 0xBD, 0xE5, 0x88, @@ -6291,12 +6291,12 @@ static uint8_t *pdcp_test_data_out[] = { 0x7D, 0x2D, 0xE0, 0x3C, 0xE3, 0x81, 0xAA, 0xEA, 0xCC, 0xD7, 0xFC, 0x46, 0x07, 0x7C, 0x8E, 0x8E, 0x0E, 0x99, 0xB8, 0x31, 0xE1, 0x52, 0x5E, 0x6B}, /* User Plane w/ZUC enc. + AES CMAC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, + (uint8_t[]){0x80, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, 0x74, 0xC2, 0xD7, 0xFF, 0x74, 0x59, 0x3A, 0x69, 0xD1, 0x8B, 0x65, 0x98, 0xB9, 0x3C, 0xFB, 0x63, 0xB1, 0x9E, 0xB7, 0xCA, 0x04, 0x68, 0xB9, 0xAB, 0xA2, 0x5A, 0xAF, 0x15, 0x8E, 0x71, 0xED, 0xE4, 0xFA, 0x99, 0x79, 0xF9, 0x51, 0x54, 0x82, 0x69, 0x4C, 0x45, 0x0B, 0xFA, 0x87, 0x4D, 0x97, 0x6E, - 0xB0, 0xC9, 0x06, 0x08, 0x6B, 0xFC, 0x4A, 0x85, 0x70, 0xF9, 0x4B, 0x2F}, + 0xB0, 0xC9, 0x06, 0x08, 0x6B, 0xFC, 0x4A, 0x85, 0xC0, 0xD5, 0x81, 0xD3}, /* User Plane w/ZUC enc. + AES CMAC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x30, 0x62, 0x48, 0xC0, 0xB1, 0xED, 0x1F, 0x13, 0x8A, 0x7A, 0x62, 0x40, 0x12, 0x35, 0x54, 0x03, 0x93, 0xBD, 0xE5, 0x88, @@ -6305,12 +6305,12 @@ static uint8_t *pdcp_test_data_out[] = { 0x7D, 0x2D, 0xE0, 0x3C, 0xE3, 0x81, 0xAA, 0xEA, 0xCC, 0xD7, 0xFC, 0x46, 0x07, 0x7C, 0x8E, 0x8E, 0x0E, 0x99, 0xB8, 0x31, 0xBC, 0x1C, 0x7F, 0x9C}, /* User Plane w/ZUC enc. + ZUC int. UL for 18-bit SN */ - (uint8_t[]){0x0C, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, + (uint8_t[]){0x80, 0x00, 0x01, 0x32, 0xF9, 0x21, 0x1D, 0xBB, 0xF8, 0xE5, 0x7C, 0x74, 0xC2, 0xD7, 0xFF, 0x74, 0x59, 0x3A, 0x69, 0xD1, 0x8B, 0x65, 0x98, 0xB9, 0x3C, 0xFB, 0x63, 0xB1, 0x9E, 0xB7, 0xCA, 0x04, 0x68, 0xB9, 0xAB, 0xA2, 0x5A, 0xAF, 0x15, 0x8E, 0x71, 0xED, 0xE4, 0xFA, 0x99, 0x79, 0xF9, 0x51, 0x54, 0x82, 0x69, 0x4C, 0x45, 0x0B, 0xFA, 0x87, 0x4D, 0x97, 0x6E, - 0xB0, 0xC9, 0x06, 0x08, 0x6B, 0xFC, 0x4A, 0x85, 0xF6, 0xBB, 0x2E, 0x38}, + 0xB0, 0xC9, 0x06, 0x08, 0x6B, 0xFC, 0x4A, 0x85, 0xE8, 0xFA, 0xB3, 0xC2}, /* User Plane w/ZUC enc. + ZUC int. DL for 18-bit SN */ (uint8_t[]){0xF8, 0x00, 0x00, 0x30, 0x62, 0x48, 0xC0, 0xB1, 0xED, 0x1F, 0x13, 0x8A, 0x7A, 0x62, 0x40, 0x12, 0x35, 0x54, 0x03, 0x93, 0xBD, 0xE5, 0x88, diff --git a/dpdk/app/test/test_efd_perf.c b/dpdk/app/test/test_efd_perf.c index c7d6e1e42..3ed4122b6 100644 --- a/dpdk/app/test/test_efd_perf.c +++ b/dpdk/app/test/test_efd_perf.c @@ -143,7 +143,6 @@ setup_keys_and_data(struct efd_perf_params *params, unsigned int cycle) qsort(keys, KEYS_TO_ADD, MAX_KEYSIZE, key_compare); /* Sift through the list of keys and look for duplicates */ - int num_duplicates = 0; for (i = 0; i < KEYS_TO_ADD - 1; i++) { if (memcmp(keys[i], keys[i + 1], params->key_size) == 0) { /* This key already exists, try again */ diff --git a/dpdk/app/test/test_event_timer_adapter.c b/dpdk/app/test/test_event_timer_adapter.c index efd86cad5..622c62f91 100644 --- a/dpdk/app/test/test_event_timer_adapter.c +++ b/dpdk/app/test/test_event_timer_adapter.c @@ -764,7 +764,6 @@ _cancel_thread(void *args) { RTE_SET_USED(args); struct rte_event_timer *ev_tim = NULL; - uint64_t cancel_count = 0; uint16_t ret; while (!arm_done || rte_ring_count(timer_producer_ring) > 0) { @@ -774,7 +773,6 @@ _cancel_thread(void *args) ret = rte_event_timer_cancel_burst(timdev, &ev_tim, 1); TEST_ASSERT_EQUAL(ret, 1, "Failed to cancel timer"); rte_mempool_put(eventdev_test_mempool, (void *)ev_tim); - cancel_count++; } return TEST_SUCCESS; diff --git a/dpdk/app/test/test_hash_readwrite_lf_perf.c b/dpdk/app/test/test_hash_readwrite_lf_perf.c index 858c883f2..8cf61c64c 100644 --- a/dpdk/app/test/test_hash_readwrite_lf_perf.c +++ b/dpdk/app/test/test_hash_readwrite_lf_perf.c @@ -1112,7 +1112,6 @@ test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_eal_remote_launch(test_rwc_reader, (void *)(uintptr_t)read_type, enabled_core_ids[i]); - write_type = WRITE_KEY_SHIFT; pos_core = 0; /* Launch writers */ diff --git a/dpdk/app/test/test_ipsec.c b/dpdk/app/test/test_ipsec.c index 65924b057..a71dee498 100644 --- a/dpdk/app/test/test_ipsec.c +++ b/dpdk/app/test/test_ipsec.c @@ -310,8 +310,10 @@ testsuite_setup(void) } } - if (ts_params->valid_dev_found == 0) - return TEST_FAILED; + if (ts_params->valid_dev_found == 0) { + RTE_LOG(WARNING, USER1, "No compatible crypto device found.\n"); + return TEST_SKIPPED; + } ts_params->mbuf_pool = rte_pktmbuf_pool_create( "CRYPTO_MBUFPOOL", @@ -617,7 +619,8 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, rte_memcpy(dst, string, len); dst += len; /* copy pad bytes */ - rte_memcpy(dst, esp_pad_bytes, padlen); + rte_memcpy(dst, esp_pad_bytes, RTE_MIN(padlen, + sizeof(esp_pad_bytes))); dst += padlen; /* copy ESP tail header */ rte_memcpy(dst, &espt, sizeof(espt)); diff --git a/dpdk/app/test/test_member.c b/dpdk/app/test/test_member.c index 748ddcc26..0e3681ab4 100644 --- a/dpdk/app/test/test_member.c +++ b/dpdk/app/test/test_member.c @@ -545,7 +545,6 @@ setup_keys_and_data(void) qsort(generated_keys, MAX_ENTRIES, KEY_SIZE, key_compare); /* Sift through the list of keys and look for duplicates */ - int num_duplicates = 0; for (i = 0; i < MAX_ENTRIES - 1; i++) { if (memcmp(generated_keys[i], generated_keys[i + 1], KEY_SIZE) == 0) { diff --git a/dpdk/app/test/test_member_perf.c b/dpdk/app/test/test_member_perf.c index e2840f12d..a31240199 100644 --- a/dpdk/app/test/test_member_perf.c +++ b/dpdk/app/test/test_member_perf.c @@ -150,7 +150,6 @@ setup_keys_and_data(struct member_perf_params *params, unsigned int cycle, qsort(keys, KEYS_TO_ADD, MAX_KEYSIZE, key_compare); /* Sift through the list of keys and look for duplicates */ - int num_duplicates = 0; for (i = 0; i < KEYS_TO_ADD - 1; i++) { if (memcmp(keys[i], keys[i + 1], params->key_size) == 0) { diff --git a/dpdk/doc/guides/contributing/abi_policy.rst b/dpdk/doc/guides/contributing/abi_policy.rst index 87942c8ac..7d0a48e88 100644 --- a/dpdk/doc/guides/contributing/abi_policy.rst +++ b/dpdk/doc/guides/contributing/abi_policy.rst @@ -163,7 +163,7 @@ The requirements for changing the ABI are: API becomes non-experimental, then the old one is marked with ``__rte_deprecated``. - - The depreciated API should follow the notification process to be removed, + - The deprecated API should follow the notification process to be removed, see :ref:`deprecation_notices`. - At the declaration of the next major ABI version, those ABI changes then diff --git a/dpdk/doc/guides/contributing/abi_versioning.rst b/dpdk/doc/guides/contributing/abi_versioning.rst index ea9d99606..6160fa1ef 100644 --- a/dpdk/doc/guides/contributing/abi_versioning.rst +++ b/dpdk/doc/guides/contributing/abi_versioning.rst @@ -94,7 +94,7 @@ that library. ... However when a new ABI version is declared, for example DPDK ``21``, old -depreciated functions may be safely removed at this point and the entire old +deprecated functions may be safely removed at this point and the entire old major ABI version removed, see the section :ref:`deprecating_entire_abi` on how this may be done. diff --git a/dpdk/doc/guides/nics/index.rst b/dpdk/doc/guides/nics/index.rst index d61c27fdf..555ed13e3 100644 --- a/dpdk/doc/guides/nics/index.rst +++ b/dpdk/doc/guides/nics/index.rst @@ -26,6 +26,7 @@ Network Interface Controller Drivers ena enetc enic + fail_safe fm10k hinic hns3 @@ -33,9 +34,9 @@ Network Interface Controller Drivers ice ifc igb + intel_vf ipn3ke ixgbe - intel_vf kni liquidio memif @@ -48,6 +49,7 @@ Network Interface Controller Drivers nfp octeontx octeontx2 + pcap_ring pfe qede sfc_efx @@ -56,8 +58,6 @@ Network Interface Controller Drivers tap thunderx vdev_netvsc - virtio vhost + virtio vmxnet3 - pcap_ring - fail_safe diff --git a/dpdk/doc/guides/nics/mlx5.rst b/dpdk/doc/guides/nics/mlx5.rst index 8f7b28527..5d2ffe416 100644 --- a/dpdk/doc/guides/nics/mlx5.rst +++ b/dpdk/doc/guides/nics/mlx5.rst @@ -226,6 +226,8 @@ Limitations TCP header (122B). - Rx queue with LRO offload enabled, receiving a non-LRO packet, can forward it with size limited to max LRO size, not to max RX packet length. + - The driver rounds down the port configuration value ``max_lro_pkt_size`` + (from ``rte_eth_rxmode``) to a multiple of 256 due to hardware limitation. - Timestamps: diff --git a/dpdk/doc/guides/nics/virtio.rst b/dpdk/doc/guides/nics/virtio.rst index 3059bb8fb..1fe3ae1a4 100644 --- a/dpdk/doc/guides/nics/virtio.rst +++ b/dpdk/doc/guides/nics/virtio.rst @@ -43,7 +43,7 @@ Features and Limitations of virtio PMD In this release, the virtio PMD provides the basic functionality of packet reception and transmission. * It supports merge-able buffers per packet when receiving packets and scattered buffer per packet - when transmitting packets. The packet size supported is from 64 to 1518. + when transmitting packets. The packet size supported is from 64 to 9728. * It supports multicast packets and promiscuous mode. diff --git a/dpdk/doc/guides/rel_notes/release_19_11.rst b/dpdk/doc/guides/rel_notes/release_19_11.rst index 5a40e635b..2f4a0f33d 100644 --- a/dpdk/doc/guides/rel_notes/release_19_11.rst +++ b/dpdk/doc/guides/rel_notes/release_19_11.rst @@ -4819,3 +4819,209 @@ We are happy to state that - again - more of them got fixed in 19.11.12. * https://bugs.dpdk.org/show_bug.cgi?id=991 * https://bugs.dpdk.org/show_bug.cgi?id=1063 * https://bugs.dpdk.org/show_bug.cgi?id=1064 + +19.11.14 Release Notes +---------------------- + + +19.11.14 Fixes +~~~~~~~~~~~~~~ + +* app/testpmd: fix build with clang 15 +* app/testpmd: make quit flag volatile +* app/testpmd: restore ixgbe bypass commands +* bus/dpaa: fix build with clang 15 +* common/iavf: avoid copy in async mode +* common/sfc_efx/base: fix maximum Tx data count +* crypto/qat: fix build with GCC 12 +* doc: add LRO size limitation in mlx5 guide +* doc: fix net drivers ordering +* doc: fix typo depreciated instead of deprecated +* drivers: fix typos found by Lintian +* eal: fix data race in multi-process support +* eal: fix doxygen comments for UUID +* eal: fix side effect in some pointer arithmetic macros +* eventdev/eth_tx: add spinlock for adapter start/stop +* eventdev/eth_tx: fix adapter stop +* eventdev/eth_tx: fix queue delete +* eventdev: fix name of Rx conf type in documentation +* event/sw: fix device name in dump +* event/sw: fix flow ID init in self test +* event/sw: fix log in self test +* examples/fips_validation: fix typo in error log +* examples/l2fwd-crypto: fix typo in error message +* examples/vm_power_manager: use safe list iterator +* gro: fix chain index for more than 2 packets +* (HEAD -> 19.11, github-cpaelzer-stable/19.11) net/mlx5: cleanup Netlink interrupt handler +* ipsec: fix build with GCC 12 +* license: fix paths +* malloc: fix storage size for some allocations +* net: accept unaligned data in checksum routines +* net/atlantic: fix build with clang 15 +* net/bonding: fix array overflow in Rx burst +* net/bonding: fix descriptor limit reporting +* net/bonding: fix double slave link status query +* net/bonding: fix dropping valid MAC packets +* net/bonding: fix flow flush order on close +* net/bonding: fix mbuf fast free handling +* net/bonding: fix Tx hash for TCP +* net/bonding: set initial value of descriptor count alignment +* net/hns3: fix crash when secondary process access FW +* net/i40e: fix VF representor release +* net/ice/base: fix array overflow in add switch recipe +* net/ice/base: fix duplicate flow rules +* net/ice/base: fix media type of PHY 10G SFI C2C +* net/ice: check illegal packet sizes +* net/ice: fix scalar Rx path segment +* net/ice: fix scalar Tx path segment +* net/ixgbe: fix broadcast Rx on VF after promisc removal +* net/ixgbe: fix unexpected VLAN Rx in promisc mode on VF +* net/ixgbevf: fix promiscuous and allmulti +* net/memif: fix crash with different number of Rx/Tx queues +* net/mlx4: fix Verbs FD leak in secondary process +* net/mlx5: fix hairpin split with set VLAN VID action +* net/mlx5: fix invalid memory access in port closing +* net/mlx5: fix meter profile delete after disable +* net/mlx5: fix port event cleaning order +* net/mlx5: fix Verbs FD leak in secondary process +* net/mvneta: fix build with GCC 12 +* net/nfp: fix internal buffer size and MTU check +* net/nfp: improve HW info header log readability +* net/qede/base: fix 32-bit build with GCC 12 +* net/tap: fix overflow of network interface index +* net/virtio: fix crash when configured twice +* pdump: do not allow enable/disable in primary process +* power: fix some doxygen comments +* service: fix build with clang 15 +* service: fix early move to inactive status +* (tag: v19.11.14-post-22.11-rc4) doc: fix maximum packet size of virtio driver +* (tag: v19.11.14-pre-22.11-rc4) net/nfp: fix memory leak in Rx +* (tag: v19.11.14-rc1, origin-stable/19.11) version: 19.11.14-rc1 +* (tag: v19.11.14-up-to-22.11-pre-rc3) eventdev/crypto: fix multi-process +* (tag: v19.11.14-up-to-22.11-rc2) crypto/qat: fix null hash algorithm digest size +* (tag: v19.11.14-up-to-22.11-rc3) ring: remove leftover comment about watermark +* test/crypto: fix bitwise operator in a SNOW3G case +* test/crypto: fix debug messages +* test/crypto: fix PDCP vectors +* test/crypto: fix wireless auth digest segment +* test/efd: fix build with clang 15 +* test/event: fix build with clang 15 +* test/hash: remove dead code in extendable bucket test +* test/ipsec: fix build with GCC 12 +* test/ipsec: skip if no compatible device +* test/member: fix build with clang 15 +* timer: fix stopping all timers +* vhost: fix virtqueue use after free on NUMA reallocation + +19.11.14 Validation +~~~~~~~~~~~~~~~~~~~ + +* [Intel(R) Testing](https://mails.dpdk.org/archives/dev/2022-December/257208.html) + + * Basic Intel NIC (ixgbe, i40e) testing + + * Build: cover the build test combination with latest GCC/Clang version and the popular OS revision such as Ubuntu20.04&22.04, Fedora36, RHEL8.4, etc. + * PF&VF(i40e, ixgbe): test scenarios including RTE_FLOW/TSO/Jumboframe/checksum offload/VLAN/VXLAN, etc. + * PF/VF(ice): test scenarios including Switch features/Package Management/Flow Director/Advanced Tx, etc. + * Intel NIC single core/NIC performance: test scenarios including PF/VF single core performance test etc. + + * Basic Cryptodev and Virtio testing + + * Virtio: both function and performance test are covered. Such as PVP/Virtio_loopback/virtio-user loopback/virtio-net VM2VM perf testing, etc. + * Function test: test scenarios including Cryptodev API testing/CompressDev ISA-L/QAT/ZLIB PMD Testing/ etc. + * Performance test: test scenarios including Thoughput Performance /Cryptodev Latency, etc. + +* [Canonical(R) Testing](https://mails.dpdk.org/archives/dev/2022-December/257596.html) + + * Build tests of DPDK & OVS 2.13.8 on Ubuntu 20.04 (meson based) + * Functional and performance tests based on OVS-DPDK on x86_64 + * Autopkgtests for DPDK and OpenvSwitch + +* [Red Hat(R) Testing](https://mails.dpdk.org/archives/dev/2022-December/257432.html) + + * Platform + + * RHEL 8 + * Kernel 4.18 + * Qemu 6.2 + * X540-AT2 NIC(ixgbe, 10G) + * Tested on 19.11.14-RC1 + + * Tests + + * Guest with device assignment(PF) throughput testing(1G hugepage size): PASS + * Guest with device assignment(PF) throughput testing(2M hugepage size) : PASS + * Guest with device assignment(VF) throughput testing: PASS + * PVP (host dpdk testpmd as vswitch) 1Q: throughput testing: PASS + * PVP vhost-user 2Q throughput testing: PASS + * PVP vhost-user 1Q - cross numa node throughput testing: PASS + * Guest with vhost-user 2 queues throughput testing: PASS + * vhost-user reconnect with dpdk-client, qemu-server: qemu reconnect: PASS + * vhost-user reconnect with dpdk-client, qemu-server: ovs reconnect: PASS + * PVP 1Q live migration testing: PASS + * PVP 1Q cross numa node live migration testing: PASS + * Guest with ovs+dpdk+vhost-user 1Q live migration testing: PASS + * Guest with ovs+dpdk+vhost-user 1Q live migration testing (2M): PASS + * Guest with ovs+dpdk+vhost-user 2Q live migration testing: PASS + * Guest with ovs+dpdk+vhost-user 4Q live migration testing: PASS + * Host PF + DPDK testing: PASS + * Host VF + DPDK testing: PASS + +* [Nvidia(R) Testing](https://mails.dpdk.org/archives/dev/2022-December/257473.html) + + * functional tests on Mellanox hardware + + * NIC: ConnectX-4 Lx / OS: Ubuntu 20.04 LTS / Driver: MLNX_OFED_LINUX-5.8-1.0.1.1 / Firmware: 14.32.1010 + * NIC: ConnectX-5 / OS: Ubuntu 20.04 LTS / Driver: MLNX_OFED_LINUX-5.8-1.0.1.1 / Firmware: 16.35.1012 + + * Functionality: + + * Send and receive multiple types of traffic. + * testpmd xstats counter test. + * testpmd timestamp test. + * Changing/checking link status through testpmd. + * RTE flow tests: Items: eth / vlan / ipv4 / ipv6 / tcp / udp / icmp / gre / nvgre / vxlan ip in ip / mplsoudp / mplsogre + * Actions: drop / queue / rss / mark / flag / jump / count / raw_encap / raw_decap / vxlan_encap / vxlan_decap / NAT / dec_ttl + * Some RSS tests. + * VLAN filtering, stripping and insertion tests. + * Checksum and TSO tests. + * ptype tests. + * link_status_interrupt example application tests. + * l3fwd-power example application tests. + * Multi-process example applications tests. + + * Compilation tests with multiple configurations in the following OS/driver combinations are also passing: + + * Ubuntu 22.04.1 with MLNX_OFED_LINUX-5.8-1.1.2.1. + * Ubuntu 20.04.5 with MLNX_OFED_LINUX-5.8-1.1.2.1. + * Ubuntu 20.04.5 with rdma-core master (76cfaa1). + * Ubuntu 20.04.5 with rdma-core v28.0. + * Ubuntu 18.04.6 with rdma-core v17.1. + * Ubuntu 18.04.6 with rdma-core master (76cfaa1) (i386). + * Ubuntu 16.04.7 with rdma-core v22.7. + * CentOS 7 7.9.2009 with rdma-core master (76cfaa1). + * CentOS 7 7.9.2009 with MLNX_OFED_LINUX-5.8-1.0.1.1. + * CentOS 8 8.4.2105 with rdma-core master (76cfaa1). + * OpenSUSE Leap 15.4 with rdma-core v38.1. + +19.11.14 Known Issues +~~~~~~~~~~~~~~~~~~~~~ + +A few issues are still present, but none of them is an in-place regression. +So far these are mostly issues with newer compilers, toolchains and kernels +that happen to be incompatible with the older 19.11.x codebase. + +* Identified up to 19.11.13-rc1, but fixed in this release: + + * [net/mlx5: cleanup Netlink interrupt handler](https://inbox.dpdk.org/stable/DM4PR12MB516765207EE7A8999B284B5EDA1A9@DM4PR12MB5167.namprd12.prod.outlook.com/) + +* Remaining known build issues in 19.11.14 + + * [Meson based build issue with ICC-19.1.1 - cast discards qualifiers from target type](https://bugs.dpdk.org/show_bug.cgi?id=747) + * [net/quede build fail with clang 13 - unused-but-set-variable](https://bugs.dpdk.org/show_bug.cgi?id=912) + * [net/ena build failure with gcc 12](https://bugs.dpdk.org/show_bug.cgi?id=991) + * [librte_eal build error with gcc 12](https://bugs.dpdk.org/show_bug.cgi?id=985) + * [net/qede build failure with make and clang 13](https://bugs.dpdk.org/show_bug.cgi?id=912) + * [app/test-pmd/config meson build failed with Clang15.0.4](https://bugs.dpdk.org/show_bug.cgi?id=1140) + * [kernel/linux/kni make build failed with gcc7.5.0 and clang11.0.1](https://bugs.dpdk.org/show_bug.cgi?id=1141) + * [kernel/linux/igb_uio make build failed with gcc12](https://bugs.dpdk.org/show_bug.cgi?id=1142) diff --git a/dpdk/drivers/bus/dpaa/base/qbman/bman.h b/dpdk/drivers/bus/dpaa/base/qbman/bman.h index 21a6bee77..b2aa93e04 100644 --- a/dpdk/drivers/bus/dpaa/base/qbman/bman.h +++ b/dpdk/drivers/bus/dpaa/base/qbman/bman.h @@ -519,7 +519,6 @@ static inline int bm_shutdown_pool(struct bm_portal *p, u32 bpid) struct bm_mc_command *bm_cmd; struct bm_mc_result *bm_res; - int aq_count = 0; bool stop = false; while (!stop) { @@ -532,8 +531,7 @@ static inline int bm_shutdown_pool(struct bm_portal *p, u32 bpid) if (!(bm_res->verb & BM_MCR_VERB_ACQUIRE_BUFCOUNT)) { /* Pool is empty */ stop = true; - } else - ++aq_count; + } }; return 0; } diff --git a/dpdk/drivers/crypto/qat/qat_sym_session.c b/dpdk/drivers/crypto/qat/qat_sym_session.c index 8c148c9ce..d8ee2772d 100644 --- a/dpdk/drivers/crypto/qat/qat_sym_session.c +++ b/dpdk/drivers/crypto/qat/qat_sym_session.c @@ -1383,6 +1383,10 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, QAT_LOG(ERR, "invalid keylen %u", auth_keylen); return -EFAULT; } + + RTE_VERIFY(auth_keylen <= sizeof(ipad)); + RTE_VERIFY(auth_keylen <= sizeof(opad)); + rte_memcpy(ipad, auth_key, auth_keylen); rte_memcpy(opad, auth_key, auth_keylen); @@ -1710,7 +1714,12 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc, hash_offset = cdesc->cd_cur_ptr-((uint8_t *)&cdesc->cd); hash = (struct icp_qat_hw_auth_setup *)cdesc->cd_cur_ptr; hash->auth_config.reserved = 0; - hash->auth_config.config = + if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL) + hash->auth_config.config = + ICP_QAT_HW_AUTH_CONFIG_BUILD(cdesc->auth_mode, + cdesc->qat_hash_alg, 4); + else + hash->auth_config.config = ICP_QAT_HW_AUTH_CONFIG_BUILD(cdesc->auth_mode, cdesc->qat_hash_alg, digestsize); @@ -1974,10 +1983,16 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc, /* Auth CD config setup */ hash_cd_ctrl->hash_cfg_offset = hash_offset >> 3; hash_cd_ctrl->hash_flags = ICP_QAT_FW_AUTH_HDR_FLAG_NO_NESTED; - hash_cd_ctrl->inner_res_sz = digestsize; - hash_cd_ctrl->final_sz = digestsize; hash_cd_ctrl->inner_state1_sz = state1_size; - auth_param->auth_res_sz = digestsize; + if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL) { + hash_cd_ctrl->inner_res_sz = 4; + hash_cd_ctrl->final_sz = 4; + auth_param->auth_res_sz = 4; + } else { + hash_cd_ctrl->inner_res_sz = digestsize; + hash_cd_ctrl->final_sz = digestsize; + auth_param->auth_res_sz = digestsize; + } hash_cd_ctrl->inner_state2_sz = state2_size; hash_cd_ctrl->inner_state2_offset = hash_cd_ctrl->hash_cfg_offset + diff --git a/dpdk/drivers/event/sw/sw_evdev.c b/dpdk/drivers/event/sw/sw_evdev.c index d07510861..dbf5b3b5d 100644 --- a/dpdk/drivers/event/sw/sw_evdev.c +++ b/dpdk/drivers/event/sw/sw_evdev.c @@ -630,8 +630,8 @@ sw_dump(struct rte_eventdev *dev, FILE *f) "Ordered", "Atomic", "Parallel", "Directed" }; uint32_t i; - fprintf(f, "EventDev %s: ports %d, qids %d\n", "todo-fix-name", - sw->port_count, sw->qid_count); + fprintf(f, "EventDev %s: ports %d, qids %d\n", + dev->data->name, sw->port_count, sw->qid_count); fprintf(f, "\trx %"PRIu64"\n\tdrop %"PRIu64"\n\ttx %"PRIu64"\n", sw->stats.rx_pkts, sw->stats.rx_dropped, sw->stats.tx_pkts); diff --git a/dpdk/drivers/event/sw/sw_evdev_selftest.c b/dpdk/drivers/event/sw/sw_evdev_selftest.c index 38c21fa0f..e290cd477 100644 --- a/dpdk/drivers/event/sw/sw_evdev_selftest.c +++ b/dpdk/drivers/event/sw/sw_evdev_selftest.c @@ -1481,6 +1481,7 @@ xstats_id_reset_tests(struct test *t) goto fail; } ev.queue_id = t->qid[i]; + ev.flow_id = 0; ev.op = RTE_EVENT_OP_NEW; ev.mbuf = arp; arp->seqn = i; @@ -1633,8 +1634,8 @@ xstats_id_reset_tests(struct test *t) } if (val != port_expected[i]) { printf("%d: %s value incorrect, expected %"PRIu64 - " got %d\n", __LINE__, port_names[i], - port_expected[i], id); + " got %"PRIu64"\n", __LINE__, port_names[i], + port_expected[i], val); failed = 1; } /* reset to zero */ diff --git a/dpdk/drivers/net/atlantic/atl_rxtx.c b/dpdk/drivers/net/atlantic/atl_rxtx.c index 449ffd454..7640ce9fb 100644 --- a/dpdk/drivers/net/atlantic/atl_rxtx.c +++ b/dpdk/drivers/net/atlantic/atl_rxtx.c @@ -1132,10 +1132,9 @@ atl_xmit_cleanup(struct atl_tx_queue *txq) if (txq != NULL) { sw_ring = txq->sw_ring; int head = txq->tx_head; - int cnt; - int i; + int cnt = head; - for (i = 0, cnt = head; ; i++) { + while (true) { txd = &txq->hw_ring[cnt]; if (txd->dd) diff --git a/dpdk/drivers/net/bonding/rte_eth_bond_api.c b/dpdk/drivers/net/bonding/rte_eth_bond_api.c index 7ae865c2c..7b8d6fde9 100644 --- a/dpdk/drivers/net/bonding/rte_eth_bond_api.c +++ b/dpdk/drivers/net/bonding/rte_eth_bond_api.c @@ -536,6 +536,11 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) return ret; } + /* Bond mode Broadcast & 8023AD don't support MBUF_FAST_FREE offload. */ + if (internals->mode == BONDING_MODE_8023AD || + internals->mode == BONDING_MODE_BROADCAST) + internals->tx_offload_capa &= ~DEV_TX_OFFLOAD_MBUF_FAST_FREE; + bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &= internals->flow_type_rss_offloads; diff --git a/dpdk/drivers/net/bonding/rte_eth_bond_pmd.c b/dpdk/drivers/net/bonding/rte_eth_bond_pmd.c index d6dbd2fb8..a182e4306 100644 --- a/dpdk/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/dpdk/drivers/net/bonding/rte_eth_bond_pmd.c @@ -82,7 +82,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) bufs + num_rx_total, nb_pkts); num_rx_total += num_rx_slave; nb_pkts -= num_rx_slave; - if (++active_slave == slave_count) + if (++active_slave >= slave_count) active_slave = 0; } @@ -198,7 +198,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev, if (slave_info.max_rx_queues < bond_dev->data->nb_rx_queues || slave_info.max_tx_queues < bond_dev->data->nb_tx_queues) { RTE_BOND_LOG(ERR, - "%s: Slave %d capabilities doesn't allow to allocate additional queues", + "%s: Slave %d capabilities doesn't allow allocating additional queues", __func__, slave_port); return -1; } @@ -271,6 +271,24 @@ bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) { return 0; } +static bool +is_bond_mac_addr(const struct rte_ether_addr *ea, + const struct rte_ether_addr *mac_addrs, uint32_t max_mac_addrs) +{ + uint32_t i; + + for (i = 0; i < max_mac_addrs; i++) { + /* skip zero address */ + if (rte_is_zero_ether_addr(&mac_addrs[i])) + continue; + + if (rte_is_same_ether_addr(ea, &mac_addrs[i])) + return true; + } + + return false; +} + static inline uint16_t rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, bool dedicated_rxq) @@ -331,8 +349,9 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, /* Remove packet from array if: * - it is slow packet but no dedicated rxq is present, * - slave is not in collecting state, - * - bonding interface is not in promiscuous mode: - * - packet is unicast and address does not match, + * - bonding interface is not in promiscuous mode and + * packet address isn't in mac_addrs array: + * - packet is unicast, * - packet is multicast and bonding interface * is not in allmulti, */ @@ -342,12 +361,10 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, bufs[j])) || !collecting || (!promisc && - ((rte_is_unicast_ether_addr(&hdr->d_addr) && - !rte_is_same_ether_addr(bond_mac, - &hdr->d_addr)) || - (!allmulti && - rte_is_multicast_ether_addr(&hdr->d_addr)))))) { - + !is_bond_mac_addr(&hdr->d_addr, bond_mac, + BOND_MAX_MAC_ADDRS) && + (rte_is_unicast_ether_addr(&hdr->d_addr) || + !allmulti)))) { if (hdr->ether_type == ether_type_slow_be) { bond_mode_8023ad_handle_slow_pkt( internals, slaves[idx], bufs[j]); @@ -772,7 +789,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, ((char *)ipv4_hdr + ip_hdr_offset); if ((size_t)tcp_hdr + sizeof(*tcp_hdr) - < pkt_end) + <= pkt_end) l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) { @@ -2115,6 +2132,10 @@ bond_ethdev_close(struct rte_eth_dev *dev) struct rte_flow_error ferror; RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name); + + /* Flush flows in all back-end devices before removing them */ + bond_flow_ops.flush(dev, &ferror); + while (internals->slave_count != skipped) { uint16_t port_id = internals->slaves[skipped].port_id; @@ -2127,7 +2148,6 @@ bond_ethdev_close(struct rte_eth_dev *dev) skipped++; } } - bond_flow_ops.flush(dev, &ferror); bond_ethdev_free_queues(dev); rte_bitmap_reset(internals->vlan_filter_bmp); } @@ -2144,8 +2164,6 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) uint16_t max_nb_rx_queues = UINT16_MAX; uint16_t max_nb_tx_queues = UINT16_MAX; - uint16_t max_rx_desc_lim = UINT16_MAX; - uint16_t max_tx_desc_lim = UINT16_MAX; dev_info->max_mac_addrs = BOND_MAX_MAC_ADDRS; @@ -2179,12 +2197,6 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (slave_info.max_tx_queues < max_nb_tx_queues) max_nb_tx_queues = slave_info.max_tx_queues; - - if (slave_info.rx_desc_lim.nb_max < max_rx_desc_lim) - max_rx_desc_lim = slave_info.rx_desc_lim.nb_max; - - if (slave_info.tx_desc_lim.nb_max < max_tx_desc_lim) - max_tx_desc_lim = slave_info.tx_desc_lim.nb_max; } } @@ -2196,8 +2208,10 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) memcpy(&dev_info->default_txconf, &internals->default_txconf, sizeof(dev_info->default_txconf)); - dev_info->rx_desc_lim.nb_max = max_rx_desc_lim; - dev_info->tx_desc_lim.nb_max = max_tx_desc_lim; + memcpy(&dev_info->rx_desc_lim, &internals->rx_desc_lim, + sizeof(dev_info->rx_desc_lim)); + memcpy(&dev_info->tx_desc_lim, &internals->tx_desc_lim, + sizeof(dev_info->tx_desc_lim)); /** * If dedicated hw queues enabled for link bonding device in LACP mode @@ -2358,9 +2372,6 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg) * event callback */ if (slave_ethdev->data->dev_link.link_status != internals->slaves[i].last_link_status) { - internals->slaves[i].last_link_status = - slave_ethdev->data->dev_link.link_status; - bond_ethdev_lsc_event_callback(internals->slaves[i].port_id, RTE_ETH_EVENT_INTR_LSC, &bonded_ethdev->data->port_id, @@ -2859,7 +2870,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, uint8_t lsc_flag = 0; int valid_slave = 0; - uint16_t active_pos; + uint16_t active_pos, slave_idx; uint16_t i; if (type != RTE_ETH_EVENT_INTR_LSC || param == NULL) @@ -2880,6 +2891,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, for (i = 0; i < internals->slave_count; i++) { if (internals->slaves[i].port_id == port_id) { valid_slave = 1; + slave_idx = i; break; } } @@ -2968,6 +2980,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, * slaves */ bond_ethdev_link_update(bonded_eth_dev, 0); + internals->slaves[slave_idx].last_link_status = link.link_status; if (lsc_flag) { /* Cancel any possible outstanding interrupts if delays are enabled */ @@ -3330,6 +3343,15 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) memset(&internals->rx_desc_lim, 0, sizeof(internals->rx_desc_lim)); memset(&internals->tx_desc_lim, 0, sizeof(internals->tx_desc_lim)); + /* + * Do not restrict descriptor counts until + * the first back-end device gets attached. + */ + internals->rx_desc_lim.nb_max = UINT16_MAX; + internals->tx_desc_lim.nb_max = UINT16_MAX; + internals->rx_desc_lim.nb_align = 1; + internals->tx_desc_lim.nb_align = 1; + memset(internals->active_slaves, 0, sizeof(internals->active_slaves)); memset(internals->slaves, 0, sizeof(internals->slaves)); @@ -3547,7 +3569,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev) const char *name = dev->device->name; struct bond_dev_private *internals = dev->data->dev_private; struct rte_kvargs *kvlist = internals->kvlist; - uint64_t offloads; int arg_count; uint16_t port_id = dev - rte_eth_devices; uint8_t agg_mode; @@ -3608,16 +3629,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev) } } - offloads = dev->data->dev_conf.txmode.offloads; - if ((offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) && - (internals->mode == BONDING_MODE_8023AD || - internals->mode == BONDING_MODE_BROADCAST)) { - RTE_BOND_LOG(WARNING, - "bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload, force disable it."); - offloads &= ~DEV_TX_OFFLOAD_MBUF_FAST_FREE; - dev->data->dev_conf.txmode.offloads = offloads; - } - /* set the max_rx_pktlen */ internals->max_rx_pktlen = internals->candidate_max_rx_pktlen; diff --git a/dpdk/drivers/net/ena/ena_ethdev.c b/dpdk/drivers/net/ena/ena_ethdev.c index 7601d2fa2..4cad81f6e 100644 --- a/dpdk/drivers/net/ena/ena_ethdev.c +++ b/dpdk/drivers/net/ena/ena_ethdev.c @@ -601,8 +601,7 @@ static int ena_rss_reta_query(struct rte_eth_dev *dev, int reta_conf_idx; int reta_idx; - if (reta_size == 0 || reta_conf == NULL || - (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL))) + if (reta_size == 0 || reta_conf == NULL) return -EINVAL; rc = ena_com_indirect_table_get(ena_dev, indirect_table); diff --git a/dpdk/drivers/net/hns3/hns3_ethdev.c b/dpdk/drivers/net/hns3/hns3_ethdev.c index 1a8d729bc..7e5875424 100644 --- a/dpdk/drivers/net/hns3/hns3_ethdev.c +++ b/dpdk/drivers/net/hns3/hns3_ethdev.c @@ -1680,7 +1680,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, mac_addr); hns3_warn(hw, - "Failed to roll back to del setted mac addr(%s): %d", + "Failed to roll back to del set mac addr(%s): %d", mac_str, ret_val); } @@ -4999,7 +4999,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns) struct hns3_hw *hw = &hns->hw; enum hns3_reset_level reset; - hns3_check_event_cause(hns, NULL); + /* + * Check the registers to confirm whether there is reset pending. + * Note: This check may lead to schedule reset task, but only primary + * process can process the reset event. Therefore, limit the + * checking under only primary process. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + hns3_check_event_cause(hns, NULL); + reset = hns3_get_reset_level(hns, &hw->reset.pending); if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { hns3_warn(hw, "High level reset %d is pending", reset); diff --git a/dpdk/drivers/net/hns3/hns3_ethdev_vf.c b/dpdk/drivers/net/hns3/hns3_ethdev_vf.c index 29a483b2f..6e1d868a9 100644 --- a/dpdk/drivers/net/hns3/hns3_ethdev_vf.c +++ b/dpdk/drivers/net/hns3/hns3_ethdev_vf.c @@ -1918,8 +1918,15 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) if (hw->reset.level == HNS3_VF_FULL_RESET) return false; - /* Check the registers to confirm whether there is reset pending */ - hns3vf_check_event_cause(hns, NULL); + /* + * Check the registers to confirm whether there is reset pending. + * Note: This check may lead to schedule reset task, but only primary + * process can process the reset event. Therefore, limit the + * checking under only primary process. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + hns3vf_check_event_cause(hns, NULL); + reset = hns3vf_get_reset_level(hw, &hw->reset.pending); if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { hns3_warn(hw, "High level reset %d is pending", reset); diff --git a/dpdk/drivers/net/i40e/i40e_ethdev.c b/dpdk/drivers/net/i40e/i40e_ethdev.c index 62ef53646..e401a6c4e 100644 --- a/dpdk/drivers/net/i40e/i40e_ethdev.c +++ b/dpdk/drivers/net/i40e/i40e_ethdev.c @@ -1485,7 +1485,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) } /* Firmware of SFP x722 does not support 802.1ad frames ability */ if (hw->device_id == I40E_DEV_ID_SFP_X722 || - hw->device_id == I40E_DEV_ID_SFP_I_X722) + hw->device_id == I40E_DEV_ID_SFP_I_X722 || + hw->device_id == I40E_DEV_ID_10G_BASE_T_X722) hw->flags &= ~I40E_HW_FLAG_802_1AD_CAPABLE; PMD_INIT_LOG(INFO, "FW %d.%d API %d.%d NVM %02d.%02d.%02d eetrack %04x", diff --git a/dpdk/drivers/net/i40e/i40e_vf_representor.c b/dpdk/drivers/net/i40e/i40e_vf_representor.c index 40065e152..ca083e0ee 100644 --- a/dpdk/drivers/net/i40e/i40e_vf_representor.c +++ b/dpdk/drivers/net/i40e/i40e_vf_representor.c @@ -28,8 +28,6 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) { struct i40e_vf_representor *representor = ethdev->data->dev_private; - struct rte_eth_dev_data *pf_dev_data = - representor->adapter->pf.dev_data; /* get dev info for the vdev */ dev_info->device = ethdev->device; @@ -101,7 +99,7 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, }; dev_info->switch_info.name = - rte_eth_devices[pf_dev_data->port_id].device->name; + rte_eth_devices[ethdev->data->port_id].device->name; dev_info->switch_info.domain_id = representor->switch_domain_id; dev_info->switch_info.port_id = representor->vf_id; diff --git a/dpdk/drivers/net/iavf/base/iavf_adminq.c b/dpdk/drivers/net/iavf/base/iavf_adminq.c index a41402e04..43483c0ee 100644 --- a/dpdk/drivers/net/iavf/base/iavf_adminq.c +++ b/dpdk/drivers/net/iavf/base/iavf_adminq.c @@ -807,7 +807,8 @@ enum iavf_status_code iavf_asq_send_command(struct iavf_hw *hw, } /* if ready, copy the desc back to temp */ - if (iavf_asq_done(hw)) { + if (iavf_asq_done(hw) && + !details->async && !details->postpone) { iavf_memcpy(desc, desc_on_ring, sizeof(struct iavf_aq_desc), IAVF_DMA_TO_NONDMA); if (buff != NULL) diff --git a/dpdk/drivers/net/ice/base/ice_common.c b/dpdk/drivers/net/ice/base/ice_common.c index 2926a1d47..9dad1c9b3 100644 --- a/dpdk/drivers/net/ice/base/ice_common.c +++ b/dpdk/drivers/net/ice/base/ice_common.c @@ -227,7 +227,6 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi) case ICE_PHY_TYPE_LOW_1000BASE_LX: case ICE_PHY_TYPE_LOW_10GBASE_SR: case ICE_PHY_TYPE_LOW_10GBASE_LR: - case ICE_PHY_TYPE_LOW_10G_SFI_C2C: case ICE_PHY_TYPE_LOW_25GBASE_SR: case ICE_PHY_TYPE_LOW_25GBASE_LR: case ICE_PHY_TYPE_LOW_40GBASE_SR4: @@ -275,6 +274,7 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi) case ICE_PHY_TYPE_LOW_2500BASE_X: case ICE_PHY_TYPE_LOW_5GBASE_KR: case ICE_PHY_TYPE_LOW_10GBASE_KR_CR1: + case ICE_PHY_TYPE_LOW_10G_SFI_C2C: case ICE_PHY_TYPE_LOW_25GBASE_KR: case ICE_PHY_TYPE_LOW_25GBASE_KR1: case ICE_PHY_TYPE_LOW_25GBASE_KR_S: diff --git a/dpdk/drivers/net/ice/base/ice_switch.c b/dpdk/drivers/net/ice/base/ice_switch.c index 6899502a9..5daf29dbd 100644 --- a/dpdk/drivers/net/ice/base/ice_switch.c +++ b/dpdk/drivers/net/ice/base/ice_switch.c @@ -5199,7 +5199,6 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm, last_chain_entry->chain_idx = ICE_INVAL_CHAIN_IND; LIST_FOR_EACH_ENTRY(entry, &rm->rg_list, ice_recp_grp_entry, l_entry) { - last_chain_entry->fv_idx[i] = entry->chain_idx; buf[recps].content.lkup_indx[i] = entry->chain_idx; buf[recps].content.mask[i++] = CPU_TO_LE16(0xFFFF); ice_set_bit(entry->rid, rm->r_bitmap); @@ -6024,7 +6023,7 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw, /* A rule already exists with the new VSI being added */ if (ice_is_bit_set(m_entry->vsi_list_info->vsi_map, vsi_handle)) - return ICE_SUCCESS; + return ICE_ERR_ALREADY_EXISTS; /* Update the previously created VSI list set with * the new VSI ID passed in diff --git a/dpdk/drivers/net/ice/ice_rxtx.c b/dpdk/drivers/net/ice/ice_rxtx.c index 53f336e85..c115fcf89 100644 --- a/dpdk/drivers/net/ice/ice_rxtx.c +++ b/dpdk/drivers/net/ice/ice_rxtx.c @@ -1726,6 +1726,10 @@ ice_recv_scattered_pkts(void *rx_queue, } else rxm->data_len = (uint16_t)(rx_packet_len - RTE_ETHER_CRC_LEN); + } else if (rx_packet_len == 0) { + rte_pktmbuf_free_seg(rxm); + first_seg->nb_segs--; + last_seg->next = NULL; } first_seg->port = rxq->port_id; @@ -2948,6 +2952,22 @@ ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq) #define ICE_MIN_TSO_MSS 64 #define ICE_MAX_TSO_MSS 9728 #define ICE_MAX_TSO_FRAME_SIZE 262144 + +/*Check for empty mbuf*/ +static inline uint16_t +ice_check_empty_mbuf(struct rte_mbuf *tx_pkt) +{ + struct rte_mbuf *txd = tx_pkt; + + while (txd != NULL) { + if (txd->data_len == 0) + return -1; + txd = txd->next; + } + + return 0; +} + uint16_t ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) @@ -2955,6 +2975,9 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, int i, ret; uint64_t ol_flags; struct rte_mbuf *m; + struct ice_tx_queue *txq = tx_queue; + struct rte_eth_dev *dev = &rte_eth_devices[txq->port_id]; + uint16_t max_frame_size = dev->data->mtu + ICE_ETH_OVERHEAD; for (i = 0; i < nb_pkts; i++) { m = tx_pkts[i]; @@ -2971,6 +2994,14 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } + /* check the data_len in mbuf */ + if (m->data_len < ICE_TX_MIN_PKT_LEN || + m->data_len > max_frame_size) { + rte_errno = EINVAL; + PMD_DRV_LOG(ERR, "INVALID mbuf: bad data_len=[%hu]", m->data_len); + return i; + } + #ifdef RTE_LIBRTE_ETHDEV_DEBUG ret = rte_validate_tx_offload(m); if (ret != 0) { @@ -2983,6 +3014,12 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, rte_errno = -ret; return i; } + + if (ice_check_empty_mbuf(m) != 0) { + rte_errno = EINVAL; + PMD_DRV_LOG(ERR, "INVALID mbuf: last mbuf data_len=[0]"); + return i; + } } return i; } diff --git a/dpdk/drivers/net/ice/ice_rxtx.h b/dpdk/drivers/net/ice/ice_rxtx.h index 16fd9cbaf..54117bcb4 100644 --- a/dpdk/drivers/net/ice/ice_rxtx.h +++ b/dpdk/drivers/net/ice/ice_rxtx.h @@ -38,6 +38,8 @@ #define ICE_FDIR_PKT_LEN 512 +#define ICE_TX_MIN_PKT_LEN 17 + typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq); typedef void (*ice_tx_release_mbufs_t)(struct ice_tx_queue *txq); diff --git a/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c b/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c index 65d81c6ce..9a196fb9a 100644 --- a/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c @@ -8718,9 +8718,13 @@ static int ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + int mode = IXGBEVF_XCAST_MODE_NONE; int ret; - switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE)) { + if (dev->data->all_multicast) + mode = IXGBEVF_XCAST_MODE_ALLMULTI; + + switch (hw->mac.ops.update_xcast_mode(hw, mode)) { case IXGBE_SUCCESS: ret = 0; break; @@ -8742,6 +8746,9 @@ ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev) int ret; int mode = IXGBEVF_XCAST_MODE_ALLMULTI; + if (dev->data->promiscuous) + return 0; + switch (hw->mac.ops.update_xcast_mode(hw, mode)) { case IXGBE_SUCCESS: ret = 0; @@ -8763,6 +8770,9 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev) struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); int ret; + if (dev->data->promiscuous) + return 0; + switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_MULTI)) { case IXGBE_SUCCESS: ret = 0; diff --git a/dpdk/drivers/net/ixgbe/ixgbe_pf.c b/dpdk/drivers/net/ixgbe/ixgbe_pf.c index 2e46e30b7..fab9d99fb 100644 --- a/dpdk/drivers/net/ixgbe/ixgbe_pf.c +++ b/dpdk/drivers/net/ixgbe/ixgbe_pf.c @@ -754,9 +754,9 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) switch (xcast_mode) { case IXGBEVF_XCAST_MODE_NONE: - disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | + disable = IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE; - enable = 0; + enable = IXGBE_VMOLR_BAM; break; case IXGBEVF_XCAST_MODE_MULTI: disable = IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE; @@ -778,9 +778,9 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) return -1; } - disable = 0; + disable = IXGBE_VMOLR_VPE; enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | - IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE | IXGBE_VMOLR_VPE; + IXGBE_VMOLR_MPE | IXGBE_VMOLR_UPE; break; default: return -1; diff --git a/dpdk/drivers/net/memif/rte_eth_memif.c b/dpdk/drivers/net/memif/rte_eth_memif.c index 10aebadbd..d3196703d 100644 --- a/dpdk/drivers/net/memif/rte_eth_memif.c +++ b/dpdk/drivers/net/memif/rte_eth_memif.c @@ -1359,8 +1359,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->opackets = 0; stats->obytes = 0; - tmp = (pmd->role == MEMIF_ROLE_SLAVE) ? pmd->run.num_s2m_rings : - pmd->run.num_m2s_rings; + tmp = (pmd->role == MEMIF_ROLE_SLAVE) ? pmd->run.num_m2s_rings : + pmd->run.num_s2m_rings; nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp : RTE_ETHDEV_QUEUE_STAT_CNTRS; @@ -1373,8 +1373,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->ibytes += mq->n_bytes; } - tmp = (pmd->role == MEMIF_ROLE_SLAVE) ? pmd->run.num_m2s_rings : - pmd->run.num_s2m_rings; + tmp = (pmd->role == MEMIF_ROLE_SLAVE) ? pmd->run.num_s2m_rings : + pmd->run.num_m2s_rings; nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp : RTE_ETHDEV_QUEUE_STAT_CNTRS; diff --git a/dpdk/drivers/net/mlx4/mlx4.c b/dpdk/drivers/net/mlx4/mlx4.c index 8397f408f..ec607c877 100644 --- a/dpdk/drivers/net/mlx4/mlx4.c +++ b/dpdk/drivers/net/mlx4/mlx4.c @@ -880,6 +880,8 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) snprintf(name, sizeof(name), "%s port %u", mlx4_glue->get_device_name(ibv_dev), port); if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + int fd; + eth_dev = rte_eth_dev_attach_secondary(name); if (eth_dev == NULL) { ERROR("can not attach rte ethdev"); @@ -902,13 +904,14 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) if (err) goto err_secondary; /* Receive command fd from primary process. */ - err = mlx4_mp_req_verbs_cmd_fd(eth_dev); - if (err < 0) { + fd = mlx4_mp_req_verbs_cmd_fd(eth_dev); + if (fd < 0) { err = rte_errno; goto err_secondary; } /* Remap UAR for Tx queues. */ - err = mlx4_tx_uar_init_secondary(eth_dev, err); + err = mlx4_tx_uar_init_secondary(eth_dev, fd); + close(fd); if (err) { err = rte_errno; goto err_secondary; diff --git a/dpdk/drivers/net/mlx4/mlx4_mp.c b/dpdk/drivers/net/mlx4/mlx4_mp.c index 1e9b4de50..32369e81e 100644 --- a/dpdk/drivers/net/mlx4/mlx4_mp.c +++ b/dpdk/drivers/net/mlx4/mlx4_mp.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -135,15 +136,19 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) mlx4_tx_uar_uninit_secondary(dev); mlx4_proc_priv_uninit(dev); ret = mlx4_proc_priv_init(dev); - if (ret) + if (ret) { + close(mp_msg->fds[0]); return -rte_errno; + } ret = mlx4_tx_uar_init_secondary(dev, mp_msg->fds[0]); if (ret) { + close(mp_msg->fds[0]); mlx4_proc_priv_uninit(dev); return -rte_errno; } } #endif + close(mp_msg->fds[0]); rte_mb(); mp_init_msg(dev, &mp_res, param->type); res->result = 0; diff --git a/dpdk/drivers/net/mlx5/mlx5.c b/dpdk/drivers/net/mlx5/mlx5.c index dee018bbb..14f4ec2cb 100644 --- a/dpdk/drivers/net/mlx5/mlx5.c +++ b/dpdk/drivers/net/mlx5/mlx5.c @@ -579,6 +579,11 @@ mlx5_dev_shared_handler_uninstall(struct mlx5_ibv_shared *sh) if (sh->intr_handle.fd >= 0) mlx5_intr_callback_unregister(&sh->intr_handle, mlx5_dev_interrupt_handler, sh); + if (sh->intr_handle_nl.fd >= 0) { + mlx5_intr_callback_unregister(&sh->intr_handle_nl, + mlx5_dev_interrupt_handler_nl, sh); + close(sh->intr_handle_nl.fd); + } #ifdef HAVE_IBV_DEVX_ASYNC if (sh->intr_handle_devx.fd >= 0) rte_intr_callback_unregister(&sh->intr_handle_devx, @@ -1405,6 +1410,12 @@ mlx5_dev_close(struct rte_eth_dev *dev) close(priv->nl_socket_rdma); if (priv->vmwa_context) mlx5_vlan_vmwa_exit(priv->vmwa_context); + priv->sh->port[priv->ibv_port - 1].nl_ih_port_id = RTE_MAX_ETHPORTS; + /* + * The interrupt handler port id must be reset before priv is reset + * since 'mlx5_dev_interrupt_nl_cb' uses priv. + */ + rte_io_wmb(); /* * Free the shared context in last turn, because the cleanup * routines above may use some shared fields, like @@ -2291,6 +2302,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } DRV_LOG(DEBUG, "naming Ethernet device \"%s\"", name); if (rte_eal_process_type() == RTE_PROC_SECONDARY) { + int fd; + eth_dev = rte_eth_dev_attach_secondary(name); if (eth_dev == NULL) { DRV_LOG(ERR, "can not attach rte ethdev"); @@ -2303,11 +2316,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, if (err) return NULL; /* Receive command fd from primary process */ - err = mlx5_mp_req_verbs_cmd_fd(eth_dev); - if (err < 0) + fd = mlx5_mp_req_verbs_cmd_fd(eth_dev); + if (fd < 0) goto err_secondary; /* Remap UAR for Tx queues. */ - err = mlx5_tx_uar_init_secondary(eth_dev, err); + err = mlx5_tx_uar_init_secondary(eth_dev, fd); + close(fd); if (err) goto err_secondary; /* @@ -2883,6 +2897,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, return eth_dev; error: if (priv) { + priv->sh->port[priv->ibv_port - 1].nl_ih_port_id = + RTE_MAX_ETHPORTS; + rte_io_wmb(); if (priv->mreg_cp_tbl) mlx5_hlist_destroy(priv->mreg_cp_tbl, NULL, NULL); if (priv->sh) diff --git a/dpdk/drivers/net/mlx5/mlx5_ethdev.c b/dpdk/drivers/net/mlx5/mlx5_ethdev.c index 5334377c1..ca9d33556 100644 --- a/dpdk/drivers/net/mlx5/mlx5_ethdev.c +++ b/dpdk/drivers/net/mlx5/mlx5_ethdev.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1679,6 +1680,7 @@ mlx5_dev_to_eswitch_info(struct rte_eth_dev *dev) * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ +static int (*real_if_indextoname)(unsigned int, char *); int mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) { @@ -1698,7 +1700,16 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) char c; int ret; - if (!if_indextoname(ifindex, ifname)) { + // for ff tools + if (!real_if_indextoname) { + real_if_indextoname = dlsym(RTLD_NEXT, "if_indextoname"); + if (!real_if_indextoname) { + rte_errno = errno; + return -rte_errno; + } + } + + if (!real_if_indextoname(ifindex, ifname)) { rte_errno = errno; return -rte_errno; } diff --git a/dpdk/drivers/net/mlx5/mlx5_flow.c b/dpdk/drivers/net/mlx5/mlx5_flow.c index 4d13bbb06..6931ec50c 100644 --- a/dpdk/drivers/net/mlx5/mlx5_flow.c +++ b/dpdk/drivers/net/mlx5/mlx5_flow.c @@ -2870,6 +2870,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, int queue_action = 0; int action_n = 0; int split = 0; + int push_vlan = 0; const struct rte_flow_action_queue *queue; const struct rte_flow_action_rss *rss; const struct rte_flow_action_raw_encap *raw_encap; @@ -2877,6 +2878,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, if (!attr->ingress) return 0; for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { + if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN) + push_vlan = 1; switch (actions->type) { case RTE_FLOW_ACTION_TYPE_QUEUE: queue = actions->conf; @@ -2901,11 +2904,15 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: split++; action_n++; break; + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + if (push_vlan) + split++; + action_n++; + break; case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: raw_encap = actions->conf; if (raw_encap->size > @@ -3364,20 +3371,33 @@ flow_hairpin_split(struct rte_eth_dev *dev, struct mlx5_rte_flow_item_tag *tag_item; struct rte_flow_item *item; char *addr; + int push_vlan = 0; int encap = 0; mlx5_flow_id_get(priv->sh->flow_id_pool, flow_id); for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { + if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN) + push_vlan = 1; switch (actions->type) { case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: rte_memcpy(actions_tx, actions, sizeof(struct rte_flow_action)); actions_tx++; break; + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + if (push_vlan) { + rte_memcpy(actions_tx, actions, + sizeof(struct rte_flow_action)); + actions_tx++; + } else { + rte_memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); + actions_rx++; + } + break; case RTE_FLOW_ACTION_TYPE_COUNT: if (encap) { rte_memcpy(actions_tx, actions, diff --git a/dpdk/drivers/net/mlx5/mlx5_flow_meter.c b/dpdk/drivers/net/mlx5/mlx5_flow_meter.c index e51a85b47..f38dd2c35 100644 --- a/dpdk/drivers/net/mlx5/mlx5_flow_meter.c +++ b/dpdk/drivers/net/mlx5/mlx5_flow_meter.c @@ -935,7 +935,7 @@ mlx5_flow_meter_profile_update(struct rte_eth_dev *dev, fm->profile = fmp; /* Update meter params in HW (if not disabled). */ if (fm->active_state == MLX5_FLOW_METER_DISABLE) - return 0; + goto dec_ref_cnt; ret = mlx5_flow_meter_action_modify(priv, fm, &fm->profile->srtcm_prm, modify_bits, fm->active_state); if (ret) { @@ -945,6 +945,7 @@ mlx5_flow_meter_profile_update(struct rte_eth_dev *dev, NULL, "Failed to update meter" " parmeters in hardware."); } +dec_ref_cnt: old_fmp->ref_cnt--; fmp->ref_cnt++; return 0; diff --git a/dpdk/drivers/net/mlx5/mlx5_mp.c b/dpdk/drivers/net/mlx5/mlx5_mp.c index 6b7f5f3dc..7e05217cd 100644 --- a/dpdk/drivers/net/mlx5/mlx5_mp.c +++ b/dpdk/drivers/net/mlx5/mlx5_mp.c @@ -142,14 +142,18 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) mlx5_tx_uar_uninit_secondary(dev); mlx5_proc_priv_uninit(dev); ret = mlx5_proc_priv_init(dev); - if (ret) + if (ret) { + close(mp_msg->fds[0]); return -rte_errno; + } ret = mlx5_tx_uar_init_secondary(dev, mp_msg->fds[0]); if (ret) { + close(mp_msg->fds[0]); mlx5_proc_priv_uninit(dev); return -rte_errno; } } + close(mp_msg->fds[0]); rte_mb(); mp_init_msg(dev, &mp_res, param->type); res->result = 0; diff --git a/dpdk/drivers/net/mvneta/mvneta_rxtx.c b/dpdk/drivers/net/mvneta/mvneta_rxtx.c index dfa7ecc09..92b157d70 100644 --- a/dpdk/drivers/net/mvneta/mvneta_rxtx.c +++ b/dpdk/drivers/net/mvneta/mvneta_rxtx.c @@ -79,6 +79,10 @@ mvneta_buffs_refill(struct mvneta_priv *priv, struct mvneta_rxq *rxq, u16 *num) int i, ret; uint16_t nb_desc = *num; + /* To prevent GCC-12 warning. */ + if (unlikely(nb_desc == 0)) + return -1; + ret = rte_pktmbuf_alloc_bulk(rxq->mp, mbufs, nb_desc); if (ret) { MVNETA_LOG(ERR, "Failed to allocate %u mbufs.", nb_desc); diff --git a/dpdk/drivers/net/nfp/nfp_net.c b/dpdk/drivers/net/nfp/nfp_net.c index f427fad48..f2fdff566 100644 --- a/dpdk/drivers/net/nfp/nfp_net.c +++ b/dpdk/drivers/net/nfp/nfp_net.c @@ -397,6 +397,13 @@ nfp_net_configure(struct rte_eth_dev *dev) return -EINVAL; } + /* Checking MTU set */ + if (rxmode->max_rx_pkt_len > NFP_FRAME_SIZE_MAX) { + PMD_INIT_LOG(ERR, "max_rx_pkt_len (%u) larger than NFP_FRAME_SIZE_MAX (%u) not supported", + rxmode->max_rx_pkt_len, NFP_FRAME_SIZE_MAX); + return -ERANGE; + } + return 0; } @@ -718,6 +725,13 @@ nfp_net_start(struct rte_eth_dev *dev) update = NFP_NET_CFG_UPDATE_MSIX; } + /* Checking MTU set */ + if (dev->data->mtu > hw->flbufsz) { + PMD_INIT_LOG(ERR, "MTU (%u) can't be larger than the current NFP_FRAME_SIZE (%u)", + dev->data->mtu, hw->flbufsz); + return -ERANGE; + } + rte_intr_enable(intr_handle); new_ctrl = nfp_check_offloads(dev); @@ -2021,8 +2035,9 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) struct rte_mbuf *new_mb; uint16_t nb_hold; uint64_t dma_addr; - int avail; + uint16_t avail; + avail = 0; rxq = rx_queue; if (unlikely(rxq == NULL)) { /* @@ -2030,11 +2045,10 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) * enabled. But the queue needs to be configured */ RTE_LOG_DP(ERR, PMD, "RX Bad queue\n"); - return -EINVAL; + return avail; } hw = rxq->hw; - avail = 0; nb_hold = 0; while (avail < nb_pkts) { @@ -2100,7 +2114,8 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) hw->rx_offset, rxq->mbuf_size - hw->rx_offset, mb->data_len); - return -EINVAL; + rte_pktmbuf_free(mb); + break; } /* Filling the received mbuf with packet info */ @@ -2922,7 +2937,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; - hw->flbufsz = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) diff --git a/dpdk/drivers/net/nfp/nfp_net_pmd.h b/dpdk/drivers/net/nfp/nfp_net_pmd.h index 42ab369cf..2331967a1 100644 --- a/dpdk/drivers/net/nfp/nfp_net_pmd.h +++ b/dpdk/drivers/net/nfp/nfp_net_pmd.h @@ -102,6 +102,9 @@ struct nfp_net_adapter; #define NFD_CFG_MINOR_VERSION(x) (((x) & 0xff) << 0) #define NFD_CFG_MINOR_VERSION_of(x) (((x) >> 0) & 0xff) +/* Maximum supported NFP frame size (MTU + layer 2 headers) */ +#define NFP_FRAME_SIZE_MAX 10048 + #include #include diff --git a/dpdk/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/dpdk/drivers/net/nfp/nfpcore/nfp_hwinfo.c index c0516bf8e..9f848bde7 100644 --- a/dpdk/drivers/net/nfp/nfpcore/nfp_hwinfo.c +++ b/dpdk/drivers/net/nfp/nfpcore/nfp_hwinfo.c @@ -108,7 +108,7 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size) goto exit_free; header = (void *)db; - printf("NFP HWINFO header: %08x\n", *(uint32_t *)header); + printf("NFP HWINFO header: %#08x\n", *(uint32_t *)header); if (nfp_hwinfo_is_updating(header)) goto exit_free; diff --git a/dpdk/drivers/net/qede/base/ecore_init_fw_funcs.c b/dpdk/drivers/net/qede/base/ecore_init_fw_funcs.c index 6a52f32cc..4e4d1dc37 100644 --- a/dpdk/drivers/net/qede/base/ecore_init_fw_funcs.c +++ b/dpdk/drivers/net/qede/base/ecore_init_fw_funcs.c @@ -1416,7 +1416,7 @@ void ecore_init_brb_ram(struct ecore_hwfn *p_hwfn, u32 i; \ for (i = 0; i < (arr_size); i++) \ ecore_wr(dev, ptt, ((addr) + (4 * i)), \ - ((u32 *)&(arr))[i]); \ + ((u32 *)(arr))[i]); \ } while (0) #ifndef DWORDS_TO_BYTES diff --git a/dpdk/drivers/net/qede/base/ecore_int.c b/dpdk/drivers/net/qede/base/ecore_int.c index 2c4aac941..d9faf6bfc 100644 --- a/dpdk/drivers/net/qede/base/ecore_int.c +++ b/dpdk/drivers/net/qede/base/ecore_int.c @@ -366,7 +366,7 @@ enum _ecore_status_t ecore_pglueb_rbc_attn_handler(struct ecore_hwfn *p_hwfn, tmp = ecore_rd(p_hwfn, p_ptt, PGLUE_B_REG_TX_ERR_WR_DETAILS_ICPL); if (tmp & ECORE_PGLUE_ATTENTION_ICPL_VALID) - DP_NOTICE(p_hwfn, false, "ICPL erorr - %08x\n", tmp); + DP_NOTICE(p_hwfn, false, "ICPL error - %08x\n", tmp); tmp = ecore_rd(p_hwfn, p_ptt, PGLUE_B_REG_MASTER_ZLR_ERR_DETAILS); if (tmp & ECORE_PGLUE_ATTENTION_ZLR_VALID) { @@ -378,7 +378,7 @@ enum _ecore_status_t ecore_pglueb_rbc_attn_handler(struct ecore_hwfn *p_hwfn, PGLUE_B_REG_MASTER_ZLR_ERR_ADD_63_32); DP_NOTICE(p_hwfn, false, - "ICPL erorr - %08x [Address %08x:%08x]\n", + "ICPL error - %08x [Address %08x:%08x]\n", tmp, addr_hi, addr_lo); } diff --git a/dpdk/drivers/net/sfc/base/ef10_nic.c b/dpdk/drivers/net/sfc/base/ef10_nic.c index 3eb4674c5..b7eaf1d50 100644 --- a/dpdk/drivers/net/sfc/base/ef10_nic.c +++ b/dpdk/drivers/net/sfc/base/ef10_nic.c @@ -1935,7 +1935,7 @@ ef10_nic_board_cfg( /* Alignment for WPTR updates */ encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN; - encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT); + encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_TX_KER_BYTE_CNT); /* No boundary crossing limits */ encp->enc_tx_dma_desc_boundary = 0; diff --git a/dpdk/drivers/net/tap/tap_flow.c b/dpdk/drivers/net/tap/tap_flow.c index 2e471832b..f5c9ffbd8 100644 --- a/dpdk/drivers/net/tap/tap_flow.c +++ b/dpdk/drivers/net/tap/tap_flow.c @@ -1684,7 +1684,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd, struct rte_flow_item *items = implicit_rte_flows[idx].items; struct rte_flow_attr *attr = &implicit_rte_flows[idx].attr; struct rte_flow_item_eth eth_local = { .type = 0 }; - uint16_t if_index = pmd->remote_if_index; + unsigned int if_index = pmd->remote_if_index; struct rte_flow *remote_flow = NULL; struct nlmsg *msg = NULL; int err = 0; diff --git a/dpdk/drivers/net/tap/tap_tcmsgs.c b/dpdk/drivers/net/tap/tap_tcmsgs.c index b478b5951..a3aae3c81 100644 --- a/dpdk/drivers/net/tap/tap_tcmsgs.c +++ b/dpdk/drivers/net/tap/tap_tcmsgs.c @@ -19,7 +19,7 @@ struct qdisc { struct list_args { int nlsk_fd; - uint16_t ifindex; + unsigned int ifindex; void *custom_arg; }; @@ -42,7 +42,7 @@ struct qdisc_custom_arg { * Overrides the default netlink flags for this msg with those specified. */ void -tc_init_msg(struct nlmsg *msg, uint16_t ifindex, uint16_t type, uint16_t flags) +tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t flags) { struct nlmsghdr *n = &msg->nh; @@ -70,7 +70,7 @@ tc_init_msg(struct nlmsg *msg, uint16_t ifindex, uint16_t type, uint16_t flags) * 0 on success, -1 otherwise with errno set. */ static int -qdisc_del(int nlsk_fd, uint16_t ifindex, struct qdisc *qinfo) +qdisc_del(int nlsk_fd, unsigned int ifindex, struct qdisc *qinfo) { struct nlmsg msg; int fd = 0; @@ -114,7 +114,7 @@ qdisc_del(int nlsk_fd, uint16_t ifindex, struct qdisc *qinfo) * 0 on success, -1 otherwise with errno set. */ int -qdisc_add_multiq(int nlsk_fd, uint16_t ifindex) +qdisc_add_multiq(int nlsk_fd, unsigned int ifindex) { struct tc_multiq_qopt opt = {0}; struct nlmsg msg; @@ -144,7 +144,7 @@ qdisc_add_multiq(int nlsk_fd, uint16_t ifindex) * 0 on success, -1 otherwise with errno set. */ int -qdisc_add_ingress(int nlsk_fd, uint16_t ifindex) +qdisc_add_ingress(int nlsk_fd, unsigned int ifindex) { struct nlmsg msg; @@ -208,7 +208,7 @@ qdisc_del_cb(struct nlmsghdr *nh, void *arg) * 0 on success, -1 otherwise with errno set. */ static int -qdisc_iterate(int nlsk_fd, uint16_t ifindex, +qdisc_iterate(int nlsk_fd, unsigned int ifindex, int (*callback)(struct nlmsghdr *, void *), void *arg) { struct nlmsg msg; @@ -238,7 +238,7 @@ qdisc_iterate(int nlsk_fd, uint16_t ifindex, * 0 on success, -1 otherwise with errno set. */ int -qdisc_flush(int nlsk_fd, uint16_t ifindex) +qdisc_flush(int nlsk_fd, unsigned int ifindex) { return qdisc_iterate(nlsk_fd, ifindex, qdisc_del_cb, NULL); } @@ -256,7 +256,7 @@ qdisc_flush(int nlsk_fd, uint16_t ifindex) * Return -1 otherwise. */ int -qdisc_create_multiq(int nlsk_fd, uint16_t ifindex) +qdisc_create_multiq(int nlsk_fd, unsigned int ifindex) { int err = 0; @@ -282,7 +282,7 @@ qdisc_create_multiq(int nlsk_fd, uint16_t ifindex) * Return -1 otherwise. */ int -qdisc_create_ingress(int nlsk_fd, uint16_t ifindex) +qdisc_create_ingress(int nlsk_fd, unsigned int ifindex) { int err = 0; diff --git a/dpdk/drivers/net/tap/tap_tcmsgs.h b/dpdk/drivers/net/tap/tap_tcmsgs.h index 8cedea846..a64cb29d6 100644 --- a/dpdk/drivers/net/tap/tap_tcmsgs.h +++ b/dpdk/drivers/net/tap/tap_tcmsgs.h @@ -24,14 +24,14 @@ #define MULTIQ_MAJOR_HANDLE (1 << 16) -void tc_init_msg(struct nlmsg *msg, uint16_t ifindex, uint16_t type, +void tc_init_msg(struct nlmsg *msg, unsigned int ifindex, uint16_t type, uint16_t flags); -int qdisc_list(int nlsk_fd, uint16_t ifindex); -int qdisc_flush(int nlsk_fd, uint16_t ifindex); -int qdisc_create_ingress(int nlsk_fd, uint16_t ifindex); -int qdisc_create_multiq(int nlsk_fd, uint16_t ifindex); -int qdisc_add_ingress(int nlsk_fd, uint16_t ifindex); -int qdisc_add_multiq(int nlsk_fd, uint16_t ifindex); -int filter_list_ingress(int nlsk_fd, uint16_t ifindex); +int qdisc_list(int nlsk_fd, unsigned int ifindex); +int qdisc_flush(int nlsk_fd, unsigned int ifindex); +int qdisc_create_ingress(int nlsk_fd, unsigned int ifindex); +int qdisc_create_multiq(int nlsk_fd, unsigned int ifindex); +int qdisc_add_ingress(int nlsk_fd, unsigned int ifindex); +int qdisc_add_multiq(int nlsk_fd, unsigned int ifindex); +int filter_list_ingress(int nlsk_fd, unsigned int ifindex); #endif /* _TAP_TCMSGS_H_ */ diff --git a/dpdk/drivers/net/virtio/virtio_ethdev.c b/dpdk/drivers/net/virtio/virtio_ethdev.c index 4e615d2b4..7a634189b 100644 --- a/dpdk/drivers/net/virtio/virtio_ethdev.c +++ b/dpdk/drivers/net/virtio/virtio_ethdev.c @@ -2129,6 +2129,13 @@ virtio_dev_configure(struct rte_eth_dev *dev) return ret; } + /* if queues are not allocated, reinit the device */ + if (hw->vqs == NULL) { + ret = virtio_init_device(dev, hw->req_guest_features); + if (ret < 0) + return ret; + } + if ((rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM)) && !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) { diff --git a/dpdk/examples/fips_validation/main.c b/dpdk/examples/fips_validation/main.c index 739c93656..52e4e424c 100644 --- a/dpdk/examples/fips_validation/main.c +++ b/dpdk/examples/fips_validation/main.c @@ -745,7 +745,7 @@ prepare_hmac_xform(struct rte_crypto_sym_xform *xform) if (rte_cryptodev_sym_capability_check_auth(cap, auth_xform->key.length, auth_xform->digest_length, 0) != 0) { - RTE_LOG(ERR, USER1, "PMD %s key length %u IV length %u\n", + RTE_LOG(ERR, USER1, "PMD %s key length %u Digest length %u\n", info.device_name, auth_xform->key.length, auth_xform->digest_length); return -EPERM; @@ -829,7 +829,7 @@ prepare_cmac_xform(struct rte_crypto_sym_xform *xform) if (rte_cryptodev_sym_capability_check_auth(cap, auth_xform->key.length, auth_xform->digest_length, 0) != 0) { - RTE_LOG(ERR, USER1, "PMD %s key length %u IV length %u\n", + RTE_LOG(ERR, USER1, "PMD %s key length %u Digest length %u\n", info.device_name, auth_xform->key.length, auth_xform->digest_length); return -EPERM; diff --git a/dpdk/examples/l2fwd-crypto/main.c b/dpdk/examples/l2fwd-crypto/main.c index d7692464e..f7999bf77 100644 --- a/dpdk/examples/l2fwd-crypto/main.c +++ b/dpdk/examples/l2fwd-crypto/main.c @@ -2727,7 +2727,7 @@ main(int argc, char **argv) /* Enable Ethernet ports */ enabled_portcount = initialize_ports(&options); if (enabled_portcount < 1) - rte_exit(EXIT_FAILURE, "Failed to initial Ethernet ports\n"); + rte_exit(EXIT_FAILURE, "Failed to initialize Ethernet ports\n"); /* Initialize the port/queue configuration of each logical core */ RTE_ETH_FOREACH_DEV(portid) { diff --git a/dpdk/examples/vm_power_manager/channel_manager.c b/dpdk/examples/vm_power_manager/channel_manager.c index 0a28cb643..5e0bbbb4c 100644 --- a/dpdk/examples/vm_power_manager/channel_manager.c +++ b/dpdk/examples/vm_power_manager/channel_manager.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -59,16 +60,16 @@ struct virtual_machine_info { virDomainInfo info; rte_spinlock_t config_spinlock; int allow_query; - LIST_ENTRY(virtual_machine_info) vms_info; + RTE_TAILQ_ENTRY(virtual_machine_info) vms_info; }; -LIST_HEAD(, virtual_machine_info) vm_list_head; +RTE_TAILQ_HEAD(, virtual_machine_info) vm_list_head; static struct virtual_machine_info * find_domain_by_name(const char *name) { struct virtual_machine_info *info; - LIST_FOREACH(info, &vm_list_head, vms_info) { + RTE_TAILQ_FOREACH(info, &vm_list_head, vms_info) { if (!strncmp(info->name, name, CHANNEL_MGR_MAX_NAME_LEN-1)) return info; } @@ -877,7 +878,7 @@ add_vm(const char *vm_name) new_domain->allow_query = 0; rte_spinlock_init(&(new_domain->config_spinlock)); - LIST_INSERT_HEAD(&vm_list_head, new_domain, vms_info); + TAILQ_INSERT_HEAD(&vm_list_head, new_domain, vms_info); return 0; } @@ -899,7 +900,7 @@ remove_vm(const char *vm_name) rte_spinlock_unlock(&vm_info->config_spinlock); return -1; } - LIST_REMOVE(vm_info, vms_info); + TAILQ_REMOVE(&vm_list_head, vm_info, vms_info); rte_spinlock_unlock(&vm_info->config_spinlock); rte_free(vm_info); return 0; @@ -952,7 +953,7 @@ channel_manager_init(const char *path __rte_unused) { virNodeInfo info; - LIST_INIT(&vm_list_head); + TAILQ_INIT(&vm_list_head); if (connect_hypervisor(path) < 0) { global_n_host_cpus = 64; global_hypervisor_available = 0; @@ -1004,9 +1005,9 @@ channel_manager_exit(void) { unsigned i; char mask[RTE_MAX_LCORE]; - struct virtual_machine_info *vm_info; + struct virtual_machine_info *vm_info, *tmp; - LIST_FOREACH(vm_info, &vm_list_head, vms_info) { + RTE_TAILQ_FOREACH_SAFE(vm_info, &vm_list_head, vms_info, tmp) { rte_spinlock_lock(&(vm_info->config_spinlock)); @@ -1021,7 +1022,7 @@ channel_manager_exit(void) } rte_spinlock_unlock(&(vm_info->config_spinlock)); - LIST_REMOVE(vm_info, vms_info); + TAILQ_REMOVE(&vm_list_head, vm_info, vms_info); rte_free(vm_info); } diff --git a/dpdk/kernel/linux/igb_uio/compat.h b/dpdk/kernel/linux/igb_uio/compat.h index 850b359f3..71172f40c 100644 --- a/dpdk/kernel/linux/igb_uio/compat.h +++ b/dpdk/kernel/linux/igb_uio/compat.h @@ -162,7 +162,7 @@ static inline bool igbuio_kernel_is_locked_down(void) #if __has_attribute(__fallthrough__) #define fallthrough __attribute__((__fallthrough__)) #else -#define fallthrough do {} while (0) +#define fallthrough do {} while (0) /* fallthrough */ #endif #endif diff --git a/dpdk/kernel/linux/igb_uio/igb_uio.c b/dpdk/kernel/linux/igb_uio/igb_uio.c index 57d0c58ab..aea67dac4 100644 --- a/dpdk/kernel/linux/igb_uio/igb_uio.c +++ b/dpdk/kernel/linux/igb_uio/igb_uio.c @@ -15,7 +15,21 @@ #include #include -#include +/** + * These enum and macro definitions are copied from the + * file rte_pci_dev_features.h + */ +enum rte_intr_mode { + RTE_INTR_MODE_NONE = 0, + RTE_INTR_MODE_LEGACY, + RTE_INTR_MODE_MSI, + RTE_INTR_MODE_MSIX +}; +#define RTE_INTR_MODE_NONE_NAME "none" +#define RTE_INTR_MODE_LEGACY_NAME "legacy" +#define RTE_INTR_MODE_MSI_NAME "msi" +#define RTE_INTR_MODE_MSIX_NAME "msix" + #include "compat.h" @@ -498,18 +512,12 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) goto fail_release_iomem; /* set 64-bit DMA mask */ - err = pci_set_dma_mask(dev, DMA_BIT_MASK(64)); + err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)); if (err != 0) { dev_err(&dev->dev, "Cannot set DMA mask\n"); goto fail_release_iomem; } - err = pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64)); - if (err != 0) { - dev_err(&dev->dev, "Cannot set consistent DMA mask\n"); - goto fail_release_iomem; - } - /* fill uio infos */ udev->info.name = "igb_uio"; udev->info.version = "0.1"; diff --git a/dpdk/kernel/linux/kni/kni_dev.h b/dpdk/kernel/linux/kni/kni_dev.h index c15da311b..1d1aae3ad 100644 --- a/dpdk/kernel/linux/kni/kni_dev.h +++ b/dpdk/kernel/linux/kni/kni_dev.h @@ -102,11 +102,13 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk, /* Read one page struct info */ #ifdef HAVE_TSK_IN_GUP - ret = get_user_pages_remote(tsk, tsk->mm, iova, 1, - FOLL_TOUCH, &page, NULL, NULL); + ret = get_user_pages_remote(tsk, tsk->mm, iova, 1, 0, &page, NULL, NULL); #else - ret = get_user_pages_remote(tsk->mm, iova, 1, - FOLL_TOUCH, &page, NULL, NULL); + #ifdef HAVE_VMA_IN_GUP + ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL, NULL); + #else + ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL); + #endif #endif if (ret < 0) return 0; diff --git a/dpdk/kernel/linux/kni/kni_net.c b/dpdk/kernel/linux/kni/kni_net.c index 46f3f5d66..f6504db6a 100644 --- a/dpdk/kernel/linux/kni/kni_net.c +++ b/dpdk/kernel/linux/kni/kni_net.c @@ -806,8 +806,13 @@ static const struct net_device_ops kni_net_netdev_ops = { static void kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { +#if __GNUC__ >= 13 + strscpy(info->version, KNI_VERSION, sizeof(info->version)); + strscpy(info->driver, "kni", sizeof(info->driver)); +#else strlcpy(info->version, KNI_VERSION, sizeof(info->version)); strlcpy(info->driver, "kni", sizeof(info->driver)); +#endif } static const struct ethtool_ops kni_net_ethtool_ops = { diff --git a/dpdk/lib/librte_eal/common/eal_common_proc.c b/dpdk/lib/librte_eal/common/eal_common_proc.c index d88a1ebaf..a98d67101 100644 --- a/dpdk/lib/librte_eal/common/eal_common_proc.c +++ b/dpdk/lib/librte_eal/common/eal_common_proc.c @@ -257,7 +257,7 @@ rte_mp_action_unregister(const char *name) } static int -read_msg(struct mp_msg_internal *m, struct sockaddr_un *s) +read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s) { int msglen; struct iovec iov; @@ -278,7 +278,7 @@ read_msg(struct mp_msg_internal *m, struct sockaddr_un *s) msgh.msg_controllen = sizeof(control); retry: - msglen = recvmsg(mp_fd, &msgh, 0); + msglen = recvmsg(fd, &msgh, 0); /* zero length message means socket was closed */ if (msglen == 0) @@ -385,11 +385,12 @@ mp_handle(void *arg __rte_unused) { struct mp_msg_internal msg; struct sockaddr_un sa; + int fd; - while (mp_fd >= 0) { + while ((fd = __atomic_load_n(&mp_fd, __ATOMIC_RELAXED)) >= 0) { int ret; - ret = read_msg(&msg, &sa); + ret = read_msg(fd, &msg, &sa); if (ret <= 0) break; @@ -631,9 +632,8 @@ rte_mp_channel_init(void) NULL, mp_handle, NULL) < 0) { RTE_LOG(ERR, EAL, "failed to create mp thread: %s\n", strerror(errno)); - close(mp_fd); close(dir_fd); - mp_fd = -1; + close(__atomic_exchange_n(&mp_fd, -1, __ATOMIC_RELAXED)); return -1; } @@ -649,11 +649,10 @@ rte_mp_channel_cleanup(void) { int fd; - if (mp_fd < 0) + fd = __atomic_exchange_n(&mp_fd, -1, __ATOMIC_RELAXED); + if (fd < 0) return; - fd = mp_fd; - mp_fd = -1; pthread_cancel(mp_handle_tid); pthread_join(mp_handle_tid, NULL); close_socket_fd(fd); diff --git a/dpdk/lib/librte_eal/common/include/rte_common.h b/dpdk/lib/librte_eal/common/include/rte_common.h index fc938eadc..abe6bc9d1 100644 --- a/dpdk/lib/librte_eal/common/include/rte_common.h +++ b/dpdk/lib/librte_eal/common/include/rte_common.h @@ -172,7 +172,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** * subtract a byte-value offset from a pointer */ -#define RTE_PTR_SUB(ptr, x) ((void*)((uintptr_t)ptr - (x))) +#define RTE_PTR_SUB(ptr, x) ((void *)((uintptr_t)(ptr) - (x))) /** * get the difference between two pointer values, i.e. how far apart @@ -197,7 +197,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * must be a power-of-two value. */ #define RTE_PTR_ALIGN_FLOOR(ptr, align) \ - ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)ptr, align)) + ((typeof(ptr))RTE_ALIGN_FLOOR((uintptr_t)(ptr), align)) /** * Macro to align a value to a given power-of-two. The resultant value diff --git a/dpdk/lib/librte_eal/common/include/rte_uuid.h b/dpdk/lib/librte_eal/common/include/rte_uuid.h index 8b42e070a..cfefd4308 100644 --- a/dpdk/lib/librte_eal/common/include/rte_uuid.h +++ b/dpdk/lib/librte_eal/common/include/rte_uuid.h @@ -37,6 +37,9 @@ typedef unsigned char rte_uuid_t[16]; ((e) >> 8) & 0xff, (e) & 0xff \ } +/** UUID string length */ +#define RTE_UUID_STRLEN (36 + 1) + /** * Test if UUID is all zeros. * @@ -95,7 +98,6 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); * @param len * Sizeof the available string buffer */ -#define RTE_UUID_STRLEN (36 + 1) void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); #ifdef __cplusplus diff --git a/dpdk/lib/librte_eal/common/malloc_heap.c b/dpdk/lib/librte_eal/common/malloc_heap.c index 03a263a00..0343d7ff1 100644 --- a/dpdk/lib/librte_eal/common/malloc_heap.c +++ b/dpdk/lib/librte_eal/common/malloc_heap.c @@ -396,7 +396,7 @@ try_expand_heap_primary(struct malloc_heap *heap, uint64_t pg_sz, int n_segs; bool callback_triggered = false; - alloc_sz = RTE_ALIGN_CEIL(align + elt_size + + alloc_sz = RTE_ALIGN_CEIL(RTE_ALIGN_CEIL(elt_size, align) + MALLOC_ELEM_OVERHEAD, pg_sz); n_segs = alloc_sz / pg_sz; diff --git a/dpdk/lib/librte_eal/common/malloc_mp.c b/dpdk/lib/librte_eal/common/malloc_mp.c index f9d558ba6..8b2f06720 100644 --- a/dpdk/lib/librte_eal/common/malloc_mp.c +++ b/dpdk/lib/librte_eal/common/malloc_mp.c @@ -185,7 +185,7 @@ handle_alloc_request(const struct malloc_mp_req *m, int n_segs; void *map_addr; - alloc_sz = RTE_ALIGN_CEIL(ar->align + ar->elt_size + + alloc_sz = RTE_ALIGN_CEIL(RTE_ALIGN_CEIL(ar->elt_size, ar->align) + MALLOC_ELEM_OVERHEAD, ar->page_sz); n_segs = alloc_sz / ar->page_sz; diff --git a/dpdk/lib/librte_eal/common/rte_service.c b/dpdk/lib/librte_eal/common/rte_service.c index d11027fcb..4d21d1bdc 100644 --- a/dpdk/lib/librte_eal/common/rte_service.c +++ b/dpdk/lib/librte_eal/common/rte_service.c @@ -101,14 +101,12 @@ rte_service_init(void) } int i; - int count = 0; struct rte_config *cfg = rte_eal_get_configuration(); for (i = 0; i < RTE_MAX_LCORE; i++) { if (lcore_config[i].core_role == ROLE_SERVICE) { if ((unsigned int)i == cfg->master_lcore) continue; rte_service_lcore_add(i); - count++; } } @@ -447,6 +445,12 @@ service_runner_func(void *arg) rte_smp_rmb(); } + /* Switch off this core for all services, to ensure that future + * calls to may_be_active() know this core is switched off. + */ + for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) + cs->service_active_on_lcore[i] = 0; + return 0; } @@ -717,11 +721,6 @@ rte_service_lcore_stop(uint32_t lcore) int32_t only_core = (1 == rte_atomic32_read(&rte_services[i].num_mapped_cores)); - /* Switch off this core for all services, to ensure that future - * calls to may_be_active() know this core is switched off. - */ - cs->service_active_on_lcore[i] = 0; - /* if the core is mapped, and the service is running, and this * is the only core that is mapped, the service would cease to * run if this core stopped, so fail instead. diff --git a/dpdk/lib/librte_eal/freebsd/eal/include/rte_os.h b/dpdk/lib/librte_eal/freebsd/eal/include/rte_os.h index 908c37e9a..c93c87d08 100644 --- a/dpdk/lib/librte_eal/freebsd/eal/include/rte_os.h +++ b/dpdk/lib/librte_eal/freebsd/eal/include/rte_os.h @@ -18,6 +18,22 @@ extern "C" { typedef cpuset_t rte_cpuset_t; #ifdef RTE_EAL_FREEBSD_CPUSET_LEGACY +#if __FreeBSD_version >= 1301000 +#define RTE_CPU_AND(dst, src1, src2) do \ +{ \ + cpuset_t tmp; \ + CPU_COPY(src1, &tmp); \ + CPU_AND(&tmp, &tmp, src2); \ + CPU_COPY(&tmp, dst); \ +} while (0) +#define RTE_CPU_OR(dst, src1, src2) do \ +{ \ + cpuset_t tmp; \ + CPU_COPY(src1, &tmp); \ + CPU_OR(&tmp, &tmp, src2); \ + CPU_COPY(&tmp, dst); \ +} while (0) +#else #define RTE_CPU_AND(dst, src1, src2) do \ { \ cpuset_t tmp; \ @@ -32,6 +48,7 @@ typedef cpuset_t rte_cpuset_t; CPU_OR(&tmp, src2); \ CPU_COPY(&tmp, dst); \ } while (0) +#endif #define RTE_CPU_FILL(set) CPU_FILL(set) /* In FreeBSD 13 CPU_NAND macro is CPU_ANDNOT */ @@ -44,6 +61,15 @@ typedef cpuset_t rte_cpuset_t; CPU_COPY(&tmp, dst); \ } while (0) #else +#if __FreeBSD_version >= 1301000 +#define RTE_CPU_NOT(dst, src) do \ +{ \ + cpuset_t tmp; \ + CPU_FILL(&tmp); \ + CPU_ANDNOT(&tmp, &tmp, src); \ + CPU_COPY(&tmp, dst); \ +} while (0) +#else #define RTE_CPU_NOT(dst, src) do \ { \ cpuset_t tmp; \ @@ -51,6 +77,7 @@ typedef cpuset_t rte_cpuset_t; CPU_ANDNOT(&tmp, src); \ CPU_COPY(&tmp, dst); \ } while (0) +#endif #endif /* CPU_NAND */ #else /* RTE_EAL_FREEBSD_CPUSET_LEGACY */ diff --git a/dpdk/lib/librte_eventdev/rte_event_crypto_adapter.c b/dpdk/lib/librte_eventdev/rte_event_crypto_adapter.c index 3c330c6cb..4f67b8faf 100644 --- a/dpdk/lib/librte_eventdev/rte_event_crypto_adapter.c +++ b/dpdk/lib/librte_eventdev/rte_event_crypto_adapter.c @@ -29,6 +29,8 @@ */ #define CRYPTO_ENQ_FLUSH_THRESHOLD 1024 +#define ECA_ADAPTER_ARRAY "crypto_adapter_array" + struct rte_event_crypto_adapter { /* Event device identifier */ uint8_t eventdev_id; @@ -117,7 +119,6 @@ eca_valid_id(uint8_t id) static int eca_init(void) { - const char *name = "crypto_adapter_array"; const struct rte_memzone *mz; unsigned int sz; @@ -125,9 +126,10 @@ eca_init(void) RTE_EVENT_CRYPTO_ADAPTER_MAX_INSTANCE; sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); - mz = rte_memzone_lookup(name); + mz = rte_memzone_lookup(ECA_ADAPTER_ARRAY); if (mz == NULL) { - mz = rte_memzone_reserve_aligned(name, sz, rte_socket_id(), 0, + mz = rte_memzone_reserve_aligned(ECA_ADAPTER_ARRAY, sz, + rte_socket_id(), 0, RTE_CACHE_LINE_SIZE); if (mz == NULL) { RTE_EDEV_LOG_ERR("failed to reserve memzone err = %" @@ -140,6 +142,22 @@ eca_init(void) return 0; } +static int +eca_memzone_lookup(void) +{ + const struct rte_memzone *mz; + + if (event_crypto_adapter == NULL) { + mz = rte_memzone_lookup(ECA_ADAPTER_ARRAY); + if (mz == NULL) + return -ENOMEM; + + event_crypto_adapter = mz->addr; + } + + return 0; +} + static inline struct rte_event_crypto_adapter * eca_id_to_adapter(uint8_t id) { @@ -1037,6 +1055,9 @@ rte_event_crypto_adapter_stats_get(uint8_t id, uint32_t i; int ret; + if (eca_memzone_lookup()) + return -ENOMEM; + EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); adapter = eca_id_to_adapter(id); @@ -1078,6 +1099,9 @@ rte_event_crypto_adapter_stats_reset(uint8_t id) struct rte_eventdev *dev; uint32_t i; + if (eca_memzone_lookup()) + return -ENOMEM; + EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); adapter = eca_id_to_adapter(id); diff --git a/dpdk/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/dpdk/lib/librte_eventdev/rte_event_eth_rx_adapter.h index 2dd259c27..8a9db6990 100644 --- a/dpdk/lib/librte_eventdev/rte_event_eth_rx_adapter.h +++ b/dpdk/lib/librte_eventdev/rte_event_eth_rx_adapter.h @@ -336,7 +336,7 @@ int rte_event_eth_rx_adapter_free(uint8_t id); * @see RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ * * @param conf - * Additional configuration structure of type *rte_event_eth_rx_adapter_conf* + * Additional configuration structure of type *rte_event_eth_rx_adapter_queue_conf* * * @return * - 0: Success, Receive queue added correctly. diff --git a/dpdk/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/dpdk/lib/librte_eventdev/rte_event_eth_tx_adapter.c index e64c7ff2b..f403a584c 100644 --- a/dpdk/lib/librte_eventdev/rte_event_eth_tx_adapter.c +++ b/dpdk/lib/librte_eventdev/rte_event_eth_tx_adapter.c @@ -43,7 +43,7 @@ #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \ do { \ if (!txa_valid_id(id)) { \ - RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \ + RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \ return retval; \ } \ } while (0) @@ -467,14 +467,13 @@ txa_service_ctrl(uint8_t id, int start) struct txa_service_data *txa; txa = txa_service_id_to_data(id); - if (txa->service_id == TXA_INVALID_SERVICE_ID) + if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID) return 0; + rte_spinlock_lock(&txa->tx_lock); ret = rte_service_runstate_set(txa->service_id, start); - if (ret == 0 && !start) { - while (rte_service_may_be_active(txa->service_id)) - rte_pause(); - } + rte_spinlock_unlock(&txa->tx_lock); + return ret; } @@ -821,6 +820,8 @@ txa_service_queue_del(uint8_t id, uint16_t i, q, nb_queues; int ret = 0; + if (txa->txa_ethdev == NULL) + return 0; nb_queues = txa->txa_ethdev[port_id].nb_queues; if (nb_queues == 0) return 0; @@ -833,10 +834,10 @@ txa_service_queue_del(uint8_t id, if (tqi[q].added) { ret = txa_service_queue_del(id, dev, q); + i++; if (ret != 0) break; } - i++; q++; } return ret; diff --git a/dpdk/lib/librte_gro/gro_tcp4.c b/dpdk/lib/librte_gro/gro_tcp4.c index feb585514..5f3b3a82c 100644 --- a/dpdk/lib/librte_gro/gro_tcp4.c +++ b/dpdk/lib/librte_gro/gro_tcp4.c @@ -306,7 +306,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * length is greater than the max value. Store * the packet into the flow. */ - if (insert_new_item(tbl, pkt, start_time, prev_idx, + if (insert_new_item(tbl, pkt, start_time, cur_idx, sent_seq, ip_id, is_atomic) == INVALID_ARRAY_INDEX) return -1; diff --git a/dpdk/lib/librte_ipsec/esp_outb.c b/dpdk/lib/librte_ipsec/esp_outb.c index 31b920f65..7e7340871 100644 --- a/dpdk/lib/librte_ipsec/esp_outb.c +++ b/dpdk/lib/librte_ipsec/esp_outb.c @@ -169,8 +169,10 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, /* pad length */ pdlen -= sizeof(*espt); + RTE_ASSERT(pdlen <= sizeof(esp_pad_bytes)); + /* copy padding data */ - rte_memcpy(pt, esp_pad_bytes, pdlen); + rte_memcpy(pt, esp_pad_bytes, RTE_MIN(pdlen, sizeof(esp_pad_bytes))); /* update esp trailer */ espt = (struct rte_esp_tail *)(pt + pdlen); @@ -332,8 +334,10 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, /* pad length */ pdlen -= sizeof(*espt); + RTE_ASSERT(pdlen <= sizeof(esp_pad_bytes)); + /* copy padding data */ - rte_memcpy(pt, esp_pad_bytes, pdlen); + rte_memcpy(pt, esp_pad_bytes, RTE_MIN(pdlen, sizeof(esp_pad_bytes))); /* update esp trailer */ espt = (struct rte_esp_tail *)(pt + pdlen); diff --git a/dpdk/lib/librte_kni/rte_kni.h b/dpdk/lib/librte_kni/rte_kni.h index 855facd1a..0028a4de8 100644 --- a/dpdk/lib/librte_kni/rte_kni.h +++ b/dpdk/lib/librte_kni/rte_kni.h @@ -66,8 +66,8 @@ struct rte_kni_conf { uint32_t core_id; /* Core ID to bind kernel thread on */ uint16_t group_id; /* Group ID */ unsigned mbuf_size; /* mbuf size */ - struct rte_pci_addr addr; /* depreciated */ - struct rte_pci_id id; /* depreciated */ + struct rte_pci_addr addr; /* deprecated */ + struct rte_pci_id id; /* deprecated */ __extension__ uint8_t force_bind : 1; /* Flag to bind kernel thread */ diff --git a/dpdk/lib/librte_net/rte_ip.h b/dpdk/lib/librte_net/rte_ip.h index 279e88ee3..9ad8f0f3f 100644 --- a/dpdk/lib/librte_net/rte_ip.h +++ b/dpdk/lib/librte_net/rte_ip.h @@ -119,18 +119,21 @@ struct rte_ipv4_hdr { static inline uint32_t __rte_raw_cksum(const void *buf, size_t len, uint32_t sum) { - /* extend strict-aliasing rules */ - typedef uint16_t __attribute__((__may_alias__)) u16_p; - const u16_p *u16_buf = (const u16_p *)buf; - const u16_p *end = u16_buf + len / sizeof(*u16_buf); + const void *end; - for (; u16_buf != end; ++u16_buf) - sum += *u16_buf; + for (end = RTE_PTR_ADD(buf, RTE_ALIGN_FLOOR(len, sizeof(uint16_t))); + buf != end; buf = RTE_PTR_ADD(buf, sizeof(uint16_t))) { + uint16_t v; + + memcpy(&v, buf, sizeof(uint16_t)); + sum += v; + } /* if length is odd, keeping it byte order independent */ if (unlikely(len % 2)) { uint16_t left = 0; - *(unsigned char *)&left = *(const unsigned char *)end; + + memcpy(&left, end, 1); sum += left; } diff --git a/dpdk/lib/librte_pdump/rte_pdump.c b/dpdk/lib/librte_pdump/rte_pdump.c index ac94fea93..3421d180a 100644 --- a/dpdk/lib/librte_pdump/rte_pdump.c +++ b/dpdk/lib/librte_pdump/rte_pdump.c @@ -507,6 +507,12 @@ pdump_prepare_client_request(char *device, uint16_t queue, struct pdump_request *req = (struct pdump_request *)mp_req.param; struct pdump_response *resp; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + RTE_LOG(ERR, PDUMP, + "pdump enable/disable not allowed in primary process\n"); + return -EINVAL; + } + req->ver = 1; req->flags = flags; req->op = operation; diff --git a/dpdk/lib/librte_power/rte_power.h b/dpdk/lib/librte_power/rte_power.h index 04dc4cb1d..14ed6c1cf 100644 --- a/dpdk/lib/librte_power/rte_power.h +++ b/dpdk/lib/librte_power/rte_power.h @@ -153,14 +153,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id); * Scale up the frequency of a specific lcore according to the available * frequencies. * Review each environments specific documentation for usage. - * - * @param lcore_id - * lcore id. - * - * @return - * - 1 on success with frequency changed. - * - 0 on success without frequency changed. - * - Negative on error. */ extern rte_power_freq_change_t rte_power_freq_up; @@ -168,30 +160,13 @@ extern rte_power_freq_change_t rte_power_freq_up; * Scale down the frequency of a specific lcore according to the available * frequencies. * Review each environments specific documentation for usage. - * - * @param lcore_id - * lcore id. - * - * @return - * - 1 on success with frequency changed. - * - 0 on success without frequency changed. - * - Negative on error. */ - extern rte_power_freq_change_t rte_power_freq_down; /** * Scale up the frequency of a specific lcore to the highest according to the * available frequencies. * Review each environments specific documentation for usage. - * - * @param lcore_id - * lcore id. - * - * @return - * - 1 on success with frequency changed. - * - 0 on success without frequency changed. - * - Negative on error. */ extern rte_power_freq_change_t rte_power_freq_max; @@ -199,54 +174,24 @@ extern rte_power_freq_change_t rte_power_freq_max; * Scale down the frequency of a specific lcore to the lowest according to the * available frequencies. * Review each environments specific documentation for usage.. - * - * @param lcore_id - * lcore id. - * - * @return - * - 1 on success with frequency changed. - * - 0 on success without frequency changed. - * - Negative on error. */ extern rte_power_freq_change_t rte_power_freq_min; /** * Query the Turbo Boost status of a specific lcore. * Review each environments specific documentation for usage.. - * - * @param lcore_id - * lcore id. - * - * @return - * - 1 Turbo Boost is enabled for this lcore. - * - 0 Turbo Boost is disabled for this lcore. - * - Negative on error. */ extern rte_power_freq_change_t rte_power_turbo_status; /** * Enable Turbo Boost for this lcore. * Review each environments specific documentation for usage.. - * - * @param lcore_id - * lcore id. - * - * @return - * - 0 on success. - * - Negative on error. */ extern rte_power_freq_change_t rte_power_freq_enable_turbo; /** * Disable Turbo Boost for this lcore. * Review each environments specific documentation for usage.. - * - * @param lcore_id - * lcore id. - * - * @return - * - 0 on success. - * - Negative on error. */ extern rte_power_freq_change_t rte_power_freq_disable_turbo; diff --git a/dpdk/lib/librte_ring/rte_ring.h b/dpdk/lib/librte_ring/rte_ring.h index 2a9f768a1..f4a96ca84 100644 --- a/dpdk/lib/librte_ring/rte_ring.h +++ b/dpdk/lib/librte_ring/rte_ring.h @@ -146,10 +146,9 @@ ssize_t rte_ring_get_memsize(unsigned count); * object table. It is advised to use rte_ring_get_memsize() to get the * appropriate size. * - * The ring size is set to *count*, which must be a power of two. Water - * marking is disabled by default. The real usable ring size is - * *count-1* instead of *count* to differentiate a free ring from an - * empty ring. + * The ring size is set to *count*, which must be a power of two. + * The real usable ring size is *count-1* instead of *count* to + * differentiate a full ring from an empty ring. * * The ring is not added in RTE_TAILQ_RING global list. Indeed, the * memory given by the caller may not be shareable among dpdk @@ -181,10 +180,9 @@ int rte_ring_init(struct rte_ring *r, const char *name, unsigned count, * This function uses ``memzone_reserve()`` to allocate memory. Then it * calls rte_ring_init() to initialize an empty ring. * - * The new ring size is set to *count*, which must be a power of - * two. Water marking is disabled by default. The real usable ring size - * is *count-1* instead of *count* to differentiate a free ring from an - * empty ring. + * The new ring size is set to *count*, which must be a power of two. + * The real usable ring size is *count-1* instead of *count* to + * differentiate a full ring from an empty ring. * * The ring is added in RTE_TAILQ_RING list. * diff --git a/dpdk/lib/librte_timer/rte_timer.c b/dpdk/lib/librte_timer/rte_timer.c index 99862a3ba..7ea27f987 100644 --- a/dpdk/lib/librte_timer/rte_timer.c +++ b/dpdk/lib/librte_timer/rte_timer.c @@ -573,7 +573,7 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, } static int -__rte_timer_stop(struct rte_timer *tim, int local_is_locked, +__rte_timer_stop(struct rte_timer *tim, struct rte_timer_data *timer_data) { union rte_timer_status prev_status, status; @@ -595,7 +595,7 @@ __rte_timer_stop(struct rte_timer *tim, int local_is_locked, /* remove it from list */ if (prev_status.state == RTE_TIMER_PENDING) { - timer_del(tim, prev_status, local_is_locked, priv_timer); + timer_del(tim, prev_status, 0, priv_timer); __TIMER_STAT_ADD(priv_timer, pending, -1); } @@ -622,7 +622,7 @@ rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim) TIMER_DATA_VALID_GET_OR_ERR_RET(timer_data_id, timer_data, -EINVAL); - return __rte_timer_stop(tim, 0, timer_data); + return __rte_timer_stop(tim, timer_data); } /* loop until rte_timer_stop() succeed */ @@ -961,21 +961,16 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, walk_lcore = walk_lcores[i]; priv_timer = &timer_data->priv_timer[walk_lcore]; - rte_spinlock_lock(&priv_timer->list_lock); - for (tim = priv_timer->pending_head.sl_next[0]; tim != NULL; tim = next_tim) { next_tim = tim->sl_next[0]; - /* Call timer_stop with lock held */ - __rte_timer_stop(tim, 1, timer_data); + __rte_timer_stop(tim, timer_data); if (f) f(tim, f_arg); } - - rte_spinlock_unlock(&priv_timer->list_lock); } return 0; diff --git a/dpdk/lib/librte_vhost/vhost_user.c b/dpdk/lib/librte_vhost/vhost_user.c index af44d1e69..76ce6cb11 100644 --- a/dpdk/lib/librte_vhost/vhost_user.c +++ b/dpdk/lib/librte_vhost/vhost_user.c @@ -2389,6 +2389,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg, if (is_vring_iotlb(dev, vq, imsg)) { rte_spinlock_lock(&vq->access_lock); *pdev = dev = translate_ring_addresses(dev, i); + vq = dev->virtqueue[i]; rte_spinlock_unlock(&vq->access_lock); } } diff --git a/dpdk/license/README b/dpdk/license/README index 79dac8644..c78cfd9f6 100644 --- a/dpdk/license/README +++ b/dpdk/license/README @@ -58,20 +58,19 @@ DPDK Governing Board. Steps for any exception approval: 3. Technical Board then approach Governing Board for such limited approval for the given contribution only. -Any approvals shall be documented in "Licenses/exceptions.txt" with record -dates. +Any approvals shall be documented in "license/exceptions.txt" with record dates. DPDK project supported licenses are: 1. BSD 3-clause "New" or "Revised" License SPDX-License-Identifier: BSD-3-Clause URL: http://spdx.org/licenses/BSD-3-Clause#licenseText - DPDK License text: licenses/bsd-3-clause.txt + DPDK License text: license/bsd-3-clause.txt 2. GNU General Public License v2.0 only SPDX-License-Identifier: GPL-2.0 URL: http://spdx.org/licenses/GPL-2.0.html#licenseText - DPDK License text: licenses/gpl-2.0.txt + DPDK License text: license/gpl-2.0.txt 3. GNU Lesser General Public License v2.1 SPDX-License-Identifier: LGPL-2.1 URL: http://spdx.org/licenses/LGPL-2.1.html#licenseText - DPDK License text: licenses/lgpl-2.1.txt + DPDK License text: license/lgpl-2.1.txt diff --git a/example/Makefile b/example/Makefile index 1e9bb424e..167febdaf 100644 --- a/example/Makefile +++ b/example/Makefile @@ -14,7 +14,7 @@ LIBS+= -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -pthread -lnuma TARGET="helloworld" all: - cc -O -gdwarf-2 -I../lib -o ${TARGET} main.c ${LIBS} + cc -O -gdwarf-2 -I../lib -DINET6 -o ${TARGET} main.c ${LIBS} cc -O -gdwarf-2 -I../lib -o ${TARGET}_epoll main_epoll.c ${LIBS} .PHONY: clean diff --git a/freebsd/kern/kern_linker.c b/freebsd/kern/kern_linker.c index 6c653da5d..41e117eab 100644 --- a/freebsd/kern/kern_linker.c +++ b/freebsd/kern/kern_linker.c @@ -741,7 +741,7 @@ linker_file_add_dependency(linker_file_t file, linker_file_t dep) file->deps[file->ndeps] = dep; file->ndeps++; KLD_DPF(FILE, ("linker_file_add_dependency:" - " adding %s as dependency for %s\n", + " adding %s as dependency for %s\n", dep->filename, file->filename)); return (0); } @@ -1711,6 +1711,9 @@ linker_lookup_file(const char *path, int pathlen, const char *name, reclen = pathlen + strlen(sep) + namelen + extlen + 1; result = malloc(reclen, M_LINKER, M_WAITOK); for (cpp = linker_ext_list; *cpp; cpp++) { +#ifdef FSTACK + if (path != NULL && name != NULL) +#endif snprintf(result, reclen, "%.*s%s%.*s%s", pathlen, path, sep, namelen, name, *cpp); /* @@ -1776,7 +1779,11 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname, goto bad; best = cp = NULL; error = VOP_GETATTR(nd.ni_vp, &vattr, cred); +#ifdef FSTACK + if (error || vattr.va_size == 0) +#else if (error) +#endif goto bad; /* * XXX: we need to limit this number to some reasonable value diff --git a/freebsd/kern/subr_taskqueue.c b/freebsd/kern/subr_taskqueue.c index b69b8fe58..fa9e81813 100644 --- a/freebsd/kern/subr_taskqueue.c +++ b/freebsd/kern/subr_taskqueue.c @@ -337,6 +337,9 @@ taskqueue_task_nop_fn(void *context, int pending) static void taskqueue_drain_tq_queue(struct taskqueue *queue) { +#ifdef FSTACK // for dangling-pointer + static +#endif struct task t_barrier; if (STAILQ_EMPTY(&queue->tq_queue)) diff --git a/freebsd/libkern/zlib.c b/freebsd/libkern/zlib.c index f5c385480..8434f1591 100644 --- a/freebsd/libkern/zlib.c +++ b/freebsd/libkern/zlib.c @@ -13,7 +13,7 @@ * $FreeBSD$ */ -/* +/* * ==FILEVERSION 971210== * * This marker is used by the Linux installation script to determine @@ -270,7 +270,7 @@ void zcfree OF((voidpf opaque, voidpf ptr)); /* +++ deflate.h */ /* deflate.h -- internal compression state * Copyright (C) 1995-1996 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -551,7 +551,7 @@ void _tr_stored_type_only OF((deflate_state *)); /* +++ deflate.c */ /* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-1996 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -877,7 +877,7 @@ int deflateReset (strm) z_streamp strm; { deflate_state *s; - + if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; @@ -949,7 +949,7 @@ local void putShortMSB (s, b) { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); -} +} /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes @@ -1203,7 +1203,7 @@ int deflateOutputPending (strm) z_streamp strm; { if (strm == Z_NULL || strm->state == Z_NULL) return 0; - + return ((deflate_state *)(strm->state))->pending; } @@ -1694,7 +1694,7 @@ local block_state deflate_fast(s, flush) * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); - s->strstart++; + s->strstart++; } else { s->strstart += s->match_length; s->match_length = 0; @@ -1712,7 +1712,7 @@ local block_state deflate_fast(s, flush) Tracevv((stderr,"%c", s->window[s->strstart])); bflush = _tr_tally (s, 0, s->window[s->strstart]); s->lookahead--; - s->strstart++; + s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } @@ -1845,7 +1845,7 @@ local block_state deflate_slow(s, flush) /* +++ trees.c */ /* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-1996 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -2980,7 +2980,7 @@ local void copy_block(s, buf, len, header) s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { - put_short(s, (ush)len); + put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG_ZLIB s->bits_sent += 2*16; @@ -2990,6 +2990,9 @@ local void copy_block(s, buf, len, header) s->bits_sent += (ulg)len<<3; #endif /* bundle up the put_byte(s, *buf++) calls */ +#ifdef FSTACK + if (buf != NULL) +#endif zmemcpy(&s->pending_buf[s->pending], buf, len); s->pending += len; } @@ -2998,7 +3001,7 @@ local void copy_block(s, buf, len, header) /* +++ inflate.c */ /* inflate.c -- zlib interface to inflate modules * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* #include "zutil.h" */ @@ -3006,7 +3009,7 @@ local void copy_block(s, buf, len, header) /* +++ infblock.h */ /* infblock.h -- header to use infblock.c * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -3088,7 +3091,7 @@ struct internal_state { /* mode independent information */ int nowrap; /* flag for no wrapper */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */ - inflate_blocks_statef + inflate_blocks_statef *blocks; /* current inflate_blocks state */ }; @@ -3426,7 +3429,7 @@ z_streamp z; /* +++ infblock.c */ /* infblock.c -- interpret and process block types to last block * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* #include "zutil.h" */ @@ -3435,7 +3438,7 @@ z_streamp z; /* +++ inftrees.h */ /* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -3497,7 +3500,7 @@ extern int inflate_trees_free OF(( /* +++ infcodes.h */ /* infcodes.h -- header to use infcodes.c * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -3527,7 +3530,7 @@ extern void inflate_codes_free OF(( /* +++ infutil.h */ /* infutil.h -- types and macros common to blocks and codes * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -3570,7 +3573,7 @@ struct inflate_blocks_state { struct { inflate_huft *tl; inflate_huft *td; /* trees to free */ - inflate_codes_statef + inflate_codes_statef *codes; } decode; /* if CODES, current state */ } sub; /* submode */ @@ -4103,7 +4106,7 @@ int inflate_packet_flush(s) /* +++ inftrees.c */ /* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* #include "zutil.h" */ @@ -4579,7 +4582,7 @@ z_streamp z; /* for zfree function */ q = (--p)->next; ZFREE(z,p); p = q; - } + } return Z_OK; } /* --- inftrees.c */ @@ -4587,7 +4590,7 @@ z_streamp z; /* for zfree function */ /* +++ infcodes.c */ /* infcodes.c -- process literals and length/distance pairs * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* #include "zutil.h" */ @@ -4599,7 +4602,7 @@ z_streamp z; /* for zfree function */ /* +++ inffast.h */ /* inffast.h -- header to use inffast.c * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -4856,7 +4859,7 @@ z_streamp z; /* +++ infutil.c */ /* inflate_util.c -- data and routines common to blocks and codes * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* #include "zutil.h" */ @@ -4952,7 +4955,7 @@ int r; /* +++ inffast.c */ /* inffast.c -- process literals and length/distance pairs fast * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* #include "zutil.h" */ @@ -5125,7 +5128,7 @@ z_streamp z; /* +++ zutil.c */ /* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-1996 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* From: zutil.c,v 1.17 1996/07/24 13:41:12 me Exp $ */ @@ -5343,7 +5346,7 @@ void zcfree (opaque, ptr) /* +++ adler32.c */ /* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-1996 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* From: adler32.c,v 1.10 1996/05/22 11:52:18 me Exp $ */ diff --git a/freebsd/netgraph/ng_socket.h b/freebsd/netgraph/ng_socket.h index b7e831018..a467fabd9 100644 --- a/freebsd/netgraph/ng_socket.h +++ b/freebsd/netgraph/ng_socket.h @@ -5,7 +5,7 @@ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; @@ -16,7 +16,7 @@ * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. - * + * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -62,7 +62,7 @@ enum { struct sockaddr_ng { unsigned char sg_len; /* total length */ sa_family_t sg_family; /* address family */ - char sg_data[14]; /* actually longer; address value */ + char sg_data[32]; /* see NG_NODESIZ in ng_message.h */ }; #endif /* _NETGRAPH_NG_SOCKET_H_ */ diff --git a/freebsd/netinet/in_mcast.c b/freebsd/netinet/in_mcast.c index 07b5bbabb..aa1df2b7c 100644 --- a/freebsd/netinet/in_mcast.c +++ b/freebsd/netinet/in_mcast.c @@ -687,7 +687,11 @@ imf_get_source(struct in_mfilter *imf, const struct sockaddr_in *psin, if (lims == NULL) { if (imf->imf_nsrc == in_mcast_maxsocksrc) return (ENOSPC); +#ifdef FSTACK + nims = malloc(sizeof(struct ip_msource), M_INMFILTER, +#else nims = malloc(sizeof(struct in_msource), M_INMFILTER, +#endif M_NOWAIT | M_ZERO); if (nims == NULL) return (ENOMEM); @@ -718,7 +722,11 @@ imf_graft(struct in_mfilter *imf, const uint8_t st1, struct ip_msource *nims; struct in_msource *lims; +#ifdef FSTACK + nims = malloc(sizeof(struct ip_msource), M_INMFILTER, +#else nims = malloc(sizeof(struct in_msource), M_INMFILTER, +#endif M_NOWAIT | M_ZERO); if (nims == NULL) return (NULL); @@ -1053,9 +1061,10 @@ inm_merge(struct in_multi *inm, /*const*/ struct in_mfilter *imf) /* Decrement ASM listener count on transition out of ASM mode. */ if (imf->imf_st[0] == MCAST_EXCLUDE && nsrc0 == 0) { if ((imf->imf_st[1] != MCAST_EXCLUDE) || - (imf->imf_st[1] == MCAST_EXCLUDE && nsrc1 > 0)) + (imf->imf_st[1] == MCAST_EXCLUDE && nsrc1 > 0)) { CTR1(KTR_IGMPV3, "%s: --asm on inm at t1", __func__); --inm->inm_st[1].iss_asm; + } } /* Increment ASM listener count on transition to ASM mode. */ @@ -2168,7 +2177,7 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt) error = in_joingroup_locked(ifp, &gsa->sin.sin_addr, imf, &inm); if (error) { - CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", + CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", __func__); IN_MULTI_UNLOCK(); goto out_imo_free; @@ -2582,7 +2591,7 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt) int i; INP_WUNLOCK(inp); - + CTR2(KTR_IGMPV3, "%s: loading %lu source list entries", __func__, (unsigned long)msfr.msfr_nsrcs); kss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs, diff --git a/freebsd/netinet6/in6_mcast.c b/freebsd/netinet6/in6_mcast.c index 4effb57d0..58bb355cf 100644 --- a/freebsd/netinet6/in6_mcast.c +++ b/freebsd/netinet6/in6_mcast.c @@ -641,7 +641,12 @@ im6f_get_source(struct in6_mfilter *imf, const struct sockaddr_in6 *psin, if (lims == NULL) { if (imf->im6f_nsrc == in6_mcast_maxsocksrc) return (ENOSPC); + +#ifdef FSTACK + nims = malloc(sizeof(struct ip6_msource), M_IN6MFILTER, +#else nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER, +#endif M_NOWAIT | M_ZERO); if (nims == NULL) return (ENOMEM); @@ -672,7 +677,11 @@ im6f_graft(struct in6_mfilter *imf, const uint8_t st1, struct ip6_msource *nims; struct in6_msource *lims; +#ifdef FSTACK + nims = malloc(sizeof(struct ip6_msource), M_IN6MFILTER, +#else nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER, +#endif M_NOWAIT | M_ZERO); if (nims == NULL) return (NULL); @@ -999,9 +1008,10 @@ in6m_merge(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf) /* Decrement ASM listener count on transition out of ASM mode. */ if (imf->im6f_st[0] == MCAST_EXCLUDE && nsrc0 == 0) { if ((imf->im6f_st[1] != MCAST_EXCLUDE) || - (imf->im6f_st[1] == MCAST_EXCLUDE && nsrc1 > 0)) + (imf->im6f_st[1] == MCAST_EXCLUDE && nsrc1 > 0)) { CTR1(KTR_MLD, "%s: --asm on inm at t1", __func__); --inm->in6m_st[1].iss_asm; + } } /* Increment ASM listener count on transition to ASM mode. */ @@ -2440,7 +2450,7 @@ in6p_set_source_filters(struct inpcb *inp, struct sockopt *sopt) int i; INP_WUNLOCK(inp); - + CTR2(KTR_MLD, "%s: loading %lu source list entries", __func__, (unsigned long)msfr.msfr_nsrcs); kss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs, diff --git a/freebsd/sys/cdefs.h b/freebsd/sys/cdefs.h index 89516cf4a..e99429259 100644 --- a/freebsd/sys/cdefs.h +++ b/freebsd/sys/cdefs.h @@ -276,7 +276,7 @@ #endif #if !defined(__cplusplus) && !__has_extension(c_atomic) && \ - !__has_extension(cxx_atomic) + !__has_extension(cxx_atomic) && !__GNUC_PREREQ__(4, 9) /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. diff --git a/freebsd/sys/stdatomic.h b/freebsd/sys/stdatomic.h index 0a6ae4677..d7b435886 100644 --- a/freebsd/sys/stdatomic.h +++ b/freebsd/sys/stdatomic.h @@ -33,9 +33,9 @@ #include #include -#if __has_extension(c_atomic) || __has_extension(cxx_atomic) +#if defined(__clang__) && (__has_extension(c_atomic) || __has_extension(cxx_atomic)) #define __CLANG_ATOMICS -#elif __GNUC_PREREQ__(4, 7) +#elif __GNUC_PREREQ__(4, 9) #define __GNUC_ATOMICS #elif defined(__GNUC__) #define __SYNC_ATOMICS @@ -85,6 +85,9 @@ #if defined(__CLANG_ATOMICS) #define ATOMIC_VAR_INIT(value) (value) #define atomic_init(obj, value) __c11_atomic_init(obj, value) +#elif defined(__GNUC_ATOMICS) +#define ATOMIC_VAR_INIT(value) (value) +#define atomic_init(obj, value) __atomic_init(obj, value) #else #define ATOMIC_VAR_INIT(value) { .__val = (value) } #define atomic_init(obj, value) ((void)((obj)->__val = (value))) @@ -169,12 +172,9 @@ atomic_signal_fence(memory_order __order __unused) /* Atomics in kernelspace are always lock-free. */ #define atomic_is_lock_free(obj) \ ((void)(obj), (_Bool)1) -#elif defined(__CLANG_ATOMICS) +#elif defined(__CLANG_ATOMICS) || defined(__GNUC_ATOMICS) #define atomic_is_lock_free(obj) \ __atomic_is_lock_free(sizeof(*(obj)), obj) -#elif defined(__GNUC_ATOMICS) -#define atomic_is_lock_free(obj) \ - __atomic_is_lock_free(sizeof((obj)->__val), &(obj)->__val) #else #define atomic_is_lock_free(obj) \ ((void)(obj), sizeof((obj)->__val) <= sizeof(void *)) @@ -258,28 +258,28 @@ typedef _Atomic(__uintmax_t) atomic_uintmax_t; #elif defined(__GNUC_ATOMICS) #define atomic_compare_exchange_strong_explicit(object, expected, \ desired, success, failure) \ - __atomic_compare_exchange_n(&(object)->__val, expected, \ + __atomic_compare_exchange_n(object, expected, \ desired, 0, success, failure) #define atomic_compare_exchange_weak_explicit(object, expected, \ desired, success, failure) \ - __atomic_compare_exchange_n(&(object)->__val, expected, \ + __atomic_compare_exchange_n(object, expected, \ desired, 1, success, failure) #define atomic_exchange_explicit(object, desired, order) \ - __atomic_exchange_n(&(object)->__val, desired, order) + __atomic_exchange_n(object, desired, order) #define atomic_fetch_add_explicit(object, operand, order) \ - __atomic_fetch_add(&(object)->__val, operand, order) + __atomic_fetch_add(object, operand, order) #define atomic_fetch_and_explicit(object, operand, order) \ - __atomic_fetch_and(&(object)->__val, operand, order) + __atomic_fetch_and(object, operand, order) #define atomic_fetch_or_explicit(object, operand, order) \ - __atomic_fetch_or(&(object)->__val, operand, order) + __atomic_fetch_or(object, operand, order) #define atomic_fetch_sub_explicit(object, operand, order) \ - __atomic_fetch_sub(&(object)->__val, operand, order) + __atomic_fetch_sub(object, operand, order) #define atomic_fetch_xor_explicit(object, operand, order) \ - __atomic_fetch_xor(&(object)->__val, operand, order) + __atomic_fetch_xor(object, operand, order) #define atomic_load_explicit(object, order) \ - __atomic_load_n(&(object)->__val, order) + __atomic_load_n(object, order) #define atomic_store_explicit(object, desired, order) \ - __atomic_store_n(&(object)->__val, desired, order) + __atomic_store_n(object, desired, order) #else #define __atomic_apply_stride(object, operand) \ (((__typeof__((object)->__val))0) + (operand)) diff --git a/lib/Makefile b/lib/Makefile index 73ee5ef16..41d1c0e55 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,6 +1,6 @@ -# +# # Copyright (c) 2013 Patrick Kelsey. All rights reserved. -# Copyright (C) 2017 THL A29 Limited, a Tencent company. +# Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. # All rights reserved. # # Derived in part from libuinet's Makefile. @@ -20,19 +20,31 @@ PREFIX_INCLUDE=/usr/local/include PREFIX_BIN=/usr/local/bin F-STACK_CONF=/etc/f-stack.conf F-STACK_VERSION=1.21 +TGT_OS=$(shell uname) +ifeq ($(TGT_OS),FreeBSD) +CC=gcc +endif HOST_OS:=$(shell uname -s) #DEBUG=-O0 -gdwarf-2 -g3 -Wno-format-truncation +# No DPDK KNI support on FreeBSD +ifneq ($(TGT_OS),FreeBSD) FF_KNI=1 +endif + #FF_FLOW_ISOLATE=1 +#FF_FDIR=1 + +# NETGRAPH drivers ipfw #FF_NETGRAPH=1 #FF_IPFW=1 + #FF_USE_PAGE_ARRAY=1 #FF_ZC_SEND=1 FF_INET6=1 - +#FF_IPSEC=1 include ${TOPDIR}/mk/kern.pre.mk @@ -45,7 +57,7 @@ endif endif ifdef RTE_SDK -ifeq (${MACHINE_CPUARCH},aarch64) +ifeq (${MACHINE_CPUARCH},aarch64) FF_DPDK=${RTE_SDK}/build else FF_DPDK=${RTE_SDK}/x86_64-native-linuxapp-gcc @@ -65,10 +77,15 @@ INCLUDES+= -I./opt # Include search path for files that only include host OS headers HOST_INCLUDES= -I. +# Use libepoll shim on FreeBSD +ifeq ($(TGT_OS),FreeBSD) +HOST_INCLUDES+= -I/usr/local/include/libepoll-shim +endif + ifndef DEBUG HOST_CFLAGS = -O2 -frename-registers -funswitch-loops -fweb -Wno-format-truncation else -HOST_CFLAGS = ${DEBUG} +HOST_CFLAGS = ${DEBUG} endif ifdef FF_KNI @@ -78,6 +95,10 @@ endif HOST_CFLAGS+= ${DPDK_CFLAGS} HOST_CFLAGS+= ${CONF_CFLAGS} +ifdef FF_FDIR +HOST_CFLAGS+= -DFF_FDIR +endif + ifdef FF_FLOW_ISOLATE HOST_CFLAGS+= -DFF_FLOW_ISOLATE endif @@ -88,17 +109,36 @@ endif ifdef FF_IPFW HOST_CFLAGS+= -DFF_IPFW +CFLAGS+= -DFF_IPFW endif ifdef FF_USE_PAGE_ARRAY HOST_CFLAGS+= -DFF_USE_PAGE_ARRAY endif +HOST_CFLAGS+= -DINET +CFLAGS+= -DINET + ifdef FF_INET6 HOST_CFLAGS+= -DINET6 CFLAGS+= -DINET6 endif +ifdef FF_IPSEC +HOST_CFLAGS+= -DIPSEC +CFLAGS+= -DIPSEC +endif + +GCCVERGE10 = $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 10) +ifeq "$(GCCVERGE10)" "1" + CFLAGS+= -Wno-error=stringop-overflow +endif + +GCCVERGE11 = $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 11) +ifeq "$(GCCVERGE11)" "1" + CFLAGS+= -Wno-error=stringop-overread +endif + HOST_C= ${CC} -c $(HOST_CFLAGS) ${HOST_INCLUDES} ${WERROR} ${PROF} $< @@ -223,7 +263,7 @@ FF_HOST_SRCS+= \ ff_dpdk_if.c \ ff_dpdk_pcap.c \ ff_epoll.c \ - ff_init.c + ff_init.c ifdef FF_KNI FF_HOST_SRCS+= \ @@ -331,7 +371,7 @@ LIBKERN_SRCS+= \ jenkins_hash.c \ strlcpy.c \ strnlen.c \ - zlib.c + zlib.c endif @@ -495,11 +535,15 @@ NETINET6_SRCS+= \ #ip6_ipsec.c #sctp6_usrreq.c #in6_rss.c + +ifneq ($(TGT_OS),FreeBSD) ifndef FF_KNI FF_HOST_SRCS+= \ ff_dpdk_kni.c -endif -endif +endif #FF_KNI +endif #FreeBSD OS Check + +endif #INET6 ifdef FF_IPFW NETIPFW_SRCS+= \ @@ -600,7 +644,7 @@ all: libfstack.a libfstack.a: machine_includes ff_api.symlist ${MHEADERS} ${MSRCS} ${HOST_OBJS} ${ASM_OBJS} ${OBJS} ${LD} -d -r -o $*.ro ${ASM_OBJS} ${OBJS} nm $*.ro | grep -v ' U ' | cut -d ' ' -f 3 > $*_localize_list.tmp - objcopy --localize-symbols=$*_localize_list.tmp $*.ro + objcopy --localize-symbols=$*_localize_list.tmp $*.ro rm $*_localize_list.tmp objcopy --globalize-symbols=ff_api.symlist $*.ro rm -f $@ diff --git a/lib/ff_api.h b/lib/ff_api.h index 0470c8313..b27d72ed0 100644 --- a/lib/ff_api.h +++ b/lib/ff_api.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 THL A29 Limited, a Tencent company. + * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ extern "C" { struct linux_sockaddr { short sa_family; - char sa_data[126]; + char sa_data[14]; }; #define AF_INET6_LINUX 10 @@ -64,6 +64,15 @@ int ff_sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, int ff_ioctl(int fd, unsigned long request, ...); +/* + * While get sockfd from this API, and then need set it to non-blocking mode like this, + * Otherwise, sometimes the socket interface will not work properly, such as `ff_write()` + * + * int on = 1; + * ff_ioctl(sockfd, FIONBIO, &on); + * + * See also `example/main.c` + */ int ff_socket(int domain, int type, int protocol); int ff_setsockopt(int s, int level, int optname, const void *optval, @@ -87,6 +96,21 @@ int ff_getsockname(int s, struct linux_sockaddr *name, ssize_t ff_read(int d, void *buf, size_t nbytes); ssize_t ff_readv(int fd, const struct iovec *iov, int iovcnt); + +/* + * Write data to the socket sendspace buf. + * + * Note: + * The `fd` parameter need set non-blocking mode in advance if F-Stack's APP. + * Otherwise if the `nbytes` parameter is greater than + * `net.inet.tcp.sendspace + net.inet.tcp.sendbuf_inc`, + * the API will return -1, but not the length that has been sent. + * + * You also can modify the value of `net.inet.tcp.sendspace`(default 16384 bytes) + * and `net.inet.tcp.sendbuf_inc`(default 16384 bytes) with `config.ini`. + * But it should be noted that not all parameters can take effect, such as 32768 and 32768. + * `ff_sysctl` can see there values while APP is running. + */ ssize_t ff_write(int fd, const void *buf, size_t nbytes); ssize_t ff_writev(int fd, const struct iovec *iov, int iovcnt); @@ -106,13 +130,18 @@ int ff_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int ff_poll(struct pollfd fds[], nfds_t nfds, int timeout); int ff_kqueue(void); -int ff_kevent(int kq, const struct kevent *changelist, int nchanges, +int ff_kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); -int ff_kevent_do_each(int kq, const struct kevent *changelist, int nchanges, - void *eventlist, int nevents, const struct timespec *timeout, +int ff_kevent_do_each(int kq, const struct kevent *changelist, int nchanges, + void *eventlist, int nevents, const struct timespec *timeout, void (*do_each)(void **, struct kevent *)); +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 31) +int ff_gettimeofday(struct timeval *tv, void *tz); +#else int ff_gettimeofday(struct timeval *tv, struct timezone *tz); +#endif + int ff_dup(int oldfd); int ff_dup2(int oldfd, int newfd); @@ -125,6 +154,11 @@ extern int ff_fdisused(int fd); extern int ff_getmaxfd(void); +/* Get traffic for QoS or other via API. + * The size of buffer must >= siezof(struct ff_traffic_args), now is 32 bytes. + */ +void ff_get_traffic(void *buffer); + /* route api begin */ enum FF_ROUTE_CTL { FF_ROUTE_ADD, @@ -169,7 +203,7 @@ int ff_route_ctl(enum FF_ROUTE_CTL req, enum FF_ROUTE_FLAG flag, * The queue id that the packet will be dispatched to. * @return FF_DISPATCH_ERROR (-1) * Error occurs or packet is handled by user, packet will be freed. -* @return FF_DISPATCH_RESPONSE (-2) + * @return FF_DISPATCH_RESPONSE (-2) * Packet is handled by user, packet will be responsed. * */ @@ -179,6 +213,22 @@ typedef int (*dispatch_func_t)(void *data, uint16_t *len, /* regist a packet dispath function */ void ff_regist_packet_dispatcher(dispatch_func_t func); +/* + * RAW packet send direty with DPDK by user APP. + * + * @param data + * The data pointer of this packet. + * @param total + * The total length of this packet. + * @param port_id + * Current port of this packet. + * + * @return error_no + * 0 means success. + * -1 means error. + */ +int ff_dpdk_raw_packet_send(void *data, int total, uint16_t port_id); + /* dispatch api end */ /* pcb lddr api begin */ diff --git a/lib/ff_api.symlist b/lib/ff_api.symlist index 0cfa1b1b9..85f20e1ff 100755 --- a/lib/ff_api.symlist +++ b/lib/ff_api.symlist @@ -57,3 +57,5 @@ ff_mbuf_set_vlan_info ff_zc_mbuf_get ff_zc_mbuf_write ff_zc_mbuf_read +ff_get_traffic +ff_dpdk_raw_packet_send diff --git a/lib/ff_config.c b/lib/ff_config.c index 933fec9ae..3b8abb154 100644 --- a/lib/ff_config.c +++ b/lib/ff_config.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 THL A29 Limited, a Tencent company. + * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -191,6 +191,7 @@ freebsd_conf_handler(struct ff_config *cfg, const char *section, } } else { fprintf(stderr, "freebsd conf section[%s] error\n", section); + free(newconf); return 0; } @@ -366,6 +367,175 @@ parse_port_slave_list(struct ff_port_cfg *cfg, const char *v_str) return res; } +static int +parse_vlan_filter_list(struct ff_config *cfg, const char *v_str) +{ + cfg->dpdk.nb_vlan_filter = DPDK_MAX_VLAN_FILTER; + uint16_t *vlan_filter = cfg->dpdk.vlan_filter_id; + return __parse_config_list(vlan_filter, &cfg->dpdk.nb_vlan_filter, v_str); +} + +static int +vip_cfg_handler(struct ff_port_cfg *cur_port_cfg, struct ff_vlan_cfg *cur_vlan_cfg) +{ + //vip cfg + int ret, nb_vip; + char *vip_addr_array[VIP_MAX_NUM], *vip_addr_str; + char **vip_addr_array_p; + + if (cur_port_cfg) { + vip_addr_str = cur_port_cfg->vip_addr_str; + } else if (cur_vlan_cfg) { + vip_addr_str = cur_vlan_cfg->vip_addr_str; + } else { + fprintf(stdout, "vip_cfg_handler cur_port_cfg and cur_vlan_cfg both NULL, not set vip_addr\n"); + return 1; + } + + ret = rte_strsplit(vip_addr_str, strlen(vip_addr_str), &vip_addr_array[0], VIP_MAX_NUM, ';'); + if (ret <= 0) { + fprintf(stdout, "vip_cfg_handler nb_vip is 0, not set vip_addr or set invalid vip_addr %s\n", + vip_addr_str); + return 1; + } + + nb_vip = ret; + + vip_addr_array_p = (char **)calloc(nb_vip, sizeof(char *)); + if (vip_addr_array_p == NULL) { + fprintf(stderr, "vip_cfg_handler malloc failed\n"); + goto err; + } + + memcpy(vip_addr_array_p, vip_addr_array, nb_vip * sizeof(char *)); + + if (cur_port_cfg) { + cur_port_cfg->nb_vip = nb_vip; + cur_port_cfg->vip_addr_array = vip_addr_array_p; + } else if (cur_vlan_cfg) { + cur_vlan_cfg->nb_vip = nb_vip; + cur_vlan_cfg->vip_addr_array = vip_addr_array_p; + } + + return 1; + +err: + return 0; +} + +#ifdef INET6 +static int +vip6_cfg_handler(struct ff_port_cfg *cur_port_cfg, struct ff_vlan_cfg *cur_vlan_cfg) +{ + //vip6 cfg + int ret, nb_vip6; + char *vip_addr6_array[VIP_MAX_NUM], *vip_addr6_str; + char **vip_addr6_array_p; + + if (cur_port_cfg) { + vip_addr6_str = cur_port_cfg->vip_addr6_str; + } else if (cur_vlan_cfg) { + vip_addr6_str = cur_vlan_cfg->vip_addr6_str; + } else { + fprintf(stdout, "vip6_cfg_handler cur_port_cfg and cur_vlan_cfg both NULL, not set vip_addr\n"); + return 1; + } + + ret = rte_strsplit(vip_addr6_str, strlen(vip_addr6_str), + &vip_addr6_array[0], VIP_MAX_NUM, ';'); + if (ret == 0) { + fprintf(stdout, "vip6_cfg_handler nb_vip6 is 0, not set vip_addr6 or set invalid vip_addr6 %s\n", + vip_addr6_str); + return 1; + } + + nb_vip6 = ret; + + vip_addr6_array_p = (char **) calloc(nb_vip6, sizeof(char *)); + if (vip_addr6_array_p == NULL) { + fprintf(stderr, "vip6_cfg_handler malloc failed\n"); + goto err; + } + + memcpy(vip_addr6_array_p, vip_addr6_array, nb_vip6 * sizeof(char *)); + + if (cur_port_cfg) { + cur_port_cfg->nb_vip6 = nb_vip6; + cur_port_cfg->vip_addr6_array = vip_addr6_array_p; + } else if (cur_vlan_cfg) { + cur_vlan_cfg->nb_vip6 = nb_vip6; + cur_vlan_cfg->vip_addr6_array = vip_addr6_array_p; + } + + return 1; + +err: + return 0; +} +#endif + +#ifdef FF_IPFW +static int +ipfw_pr_cfg_handler(struct ff_port_cfg *cur_port_cfg, struct ff_vlan_cfg *cur_vlan_cfg) +{ + //vip cfg + int ret, nb_vip, i; + char *vip_addr_array[VIP_MAX_NUM], *vip_addr_mask_array[2], *vip_addr_str; + struct ff_ipfw_pr_cfg *vipfw_pr_cfg_p; + + if (cur_port_cfg) { + vip_addr_str = cur_port_cfg->pr_addr_str; + } else if (cur_vlan_cfg) { + vip_addr_str = cur_vlan_cfg->pr_addr_str; + } else { + fprintf(stdout, "ipfw_pr_cfg_handlercur_port_cfg and cur_vlan_cfg both NULL, not set vip_addr\n"); + return 1; + } + + ret = rte_strsplit(vip_addr_str, strlen(vip_addr_str), &vip_addr_array[0], VIP_MAX_NUM, ';'); + if (ret <= 0) { + fprintf(stdout, "ipfw_pr_cfg_handler nb_vip is 0, not set vip_addr or set invalid vip_addr %s\n", + vip_addr_str); + return 1; + } + + nb_vip = ret; + + vipfw_pr_cfg_p = (struct ff_ipfw_pr_cfg *)calloc(nb_vip, sizeof(struct ff_ipfw_pr_cfg)); + if (vipfw_pr_cfg_p == NULL) { + fprintf(stderr, "ipfw_pr_cfg_handler malloc failed\n"); + goto err; + } + + for (i = 0; i < nb_vip; i++) { + vip_addr_str = vip_addr_array[i]; + ret = rte_strsplit(vip_addr_str, strlen(vip_addr_str), &vip_addr_mask_array[0], 2, ' '); + if (ret != 2) { + fprintf(stdout, "ipfw_pr_cfg_handler addr and netmask format error %s\n", + vip_addr_str); + free(vipfw_pr_cfg_p); + return 1; + }; + + vipfw_pr_cfg_p[i].addr = vip_addr_mask_array[0]; + vipfw_pr_cfg_p[i].netmask = vip_addr_mask_array[1]; + } + + if (cur_port_cfg) { + cur_port_cfg->nb_pr = nb_vip; + cur_port_cfg->pr_cfg = vipfw_pr_cfg_p; + } else if (cur_vlan_cfg) { + cur_vlan_cfg->nb_pr = nb_vip; + cur_vlan_cfg->pr_cfg = vipfw_pr_cfg_p; + } + + return 1; + +err: + return 0; +} +#endif + static int port_cfg_handler(struct ff_config *cfg, const char *section, const char *name, const char *value) { @@ -414,7 +584,9 @@ port_cfg_handler(struct ff_config *cfg, const char *section, cur->port_id = portid; } - if (strcmp(name, "addr") == 0) { + if (strcmp(name, "if_name") == 0) { + cur->ifname = strdup(value); + } else if (strcmp(name, "addr") == 0) { cur->addr = strdup(value); } else if (strcmp(name, "netmask") == 0) { cur->netmask = strdup(value); @@ -422,26 +594,147 @@ port_cfg_handler(struct ff_config *cfg, const char *section, cur->broadcast = strdup(value); } else if (strcmp(name, "gateway") == 0) { cur->gateway = strdup(value); - } else if (strcmp(name, "pcap") == 0) { - cur->pcap = strdup(value); } else if (strcmp(name, "lcore_list") == 0) { return parse_port_lcore_list(cur, value); } else if (strcmp(name, "slave_port_list") == 0) { return parse_port_slave_list(cur, value); + } else if (strcmp(name, "vip_addr") == 0) { + cur->vip_addr_str = strdup(value); + if (cur->vip_addr_str) { + return vip_cfg_handler(cur, NULL); + } + } else if (strcmp(name, "vip_ifname") == 0) { + cur->vip_ifname = strdup(value); } +#ifdef FF_IPFW + else if (strcmp(name, "ipfw_pr") == 0) { + cur->pr_addr_str = strdup(value); + if (cur->pr_addr_str) { + return ipfw_pr_cfg_handler(cur, NULL); + } + } +#endif + #ifdef INET6 - else if (0 == strcmp(name, "addr6")) - { + else if (0 == strcmp(name, "addr6")) { cur->addr6_str = strdup(value); - } - else if (0 == strcmp(name, "prefix_len")) - { + } else if (0 == strcmp(name, "prefix_len")) { cur->prefix_len = atoi(value); + } else if (0 == strcmp(name, "gateway6")) { + cur->gateway6_str = strdup(value); + } else if (strcmp(name, "vip_addr6") == 0) { + cur->vip_addr6_str = strdup(value); + if (cur->vip_addr6_str) { + return vip6_cfg_handler(cur, NULL); + } + } else if (0 == strcmp(name, "vip_prefix_len")) { + cur->vip_prefix_len = atoi(value); + } +#endif + + return 1; +} + +static int +vlan_cfg_handler(struct ff_config *cfg, const char *section, + const char *name, const char *value) { + int vlanid, vlan_index, portid; + int ret; + + if (cfg->dpdk.nb_vlan_filter == 0) { + fprintf(stderr, "vlan_cfg_handler: must config dpdk.vlan_filter first\n"); + return 0; + } + + if (cfg->dpdk.vlan_cfgs == NULL) { + struct ff_vlan_cfg *vc = calloc(DPDK_MAX_VLAN_FILTER, sizeof(struct ff_vlan_cfg)); + if (vc == NULL) { + fprintf(stderr, "vlan_cfg_handler malloc failed\n"); + return 0; + } + cfg->dpdk.vlan_cfgs = vc; + } + + ret = sscanf(section, "vlan%d", &vlanid); + if (ret != 1) { + fprintf(stderr, "vlan_cfg_handler section[%s] error\n", section); + return 0; + } + + /* just return true if vlanid not in vlan_filter */ + for (vlan_index = 0; vlan_index < cfg->dpdk.nb_vlan_filter; vlan_index ++) { + if (vlanid == cfg->dpdk.vlan_filter_id[vlan_index]) { + break; + } + + if (vlan_index >= cfg->dpdk.nb_vlan_filter) { + fprintf(stderr, "vlan_cfg_handler section[%s] mot match vlan filter, ignore it\n", section); + return 1; + } + } + + struct ff_vlan_cfg *cur = &cfg->dpdk.vlan_cfgs[vlan_index]; + if (cur->name == NULL) { + cur->name = strdup(section); + cur->vlan_id = vlanid; + cur->vlan_idx = vlan_index; } - else if (0 == strcmp(name, "gateway6")) - { + + /* vlan not need `if_name`, should use [portN]'s `if_name` */ + /*if (strcmp(name, "if_name") == 0) { + cur->ifname = strdup(value); + } else */ + if (strcmp(name, "portid") == 0) { + portid = atoi(value); + if (portid > cfg->dpdk.max_portid) { + fprintf(stderr, "vlan_cfg_handler portid %d bigger than max port id\n", portid); + return 1; + } + struct ff_port_cfg *pc = &cfg->dpdk.port_cfgs[portid]; + cur->port_id = portid; + pc->vlan_cfgs[pc->nb_vlan] = cur; + pc->nb_vlan++; + } else if (strcmp(name, "addr") == 0) { + cur->addr = strdup(value); + } else if (strcmp(name, "netmask") == 0) { + cur->netmask = strdup(value); + } else if (strcmp(name, "broadcast") == 0) { + cur->broadcast = strdup(value); + } else if (strcmp(name, "gateway") == 0) { + cur->gateway = strdup(value); + } else if (strcmp(name, "vip_addr") == 0) { + cur->vip_addr_str = strdup(value); + if (cur->vip_addr_str) { + return vip_cfg_handler(NULL, cur); + } + /*} else if (strcmp(name, "vip_ifname") == 0) { + cur->vip_ifname = strdup(value);*/ + } + +#ifdef FF_IPFW + else if (strcmp(name, "ipfw_pr") == 0) { + cur->pr_addr_str = strdup(value); + if (cur->pr_addr_str) { + return ipfw_pr_cfg_handler(NULL, cur); + } + } +#endif + +#ifdef INET6 + else if (0 == strcmp(name, "addr6")) { + cur->addr6_str = strdup(value); + } else if (0 == strcmp(name, "prefix_len")) { + cur->prefix_len = atoi(value); + } else if (0 == strcmp(name, "gateway6")) { cur->gateway6_str = strdup(value); + } else if (strcmp(name, "vip_addr6") == 0) { + cur->vip_addr6_str = strdup(value); + if (cur->vip_addr6_str) { + return vip6_cfg_handler(NULL, cur); + } + } else if (0 == strcmp(name, "vip_prefix_len")) { + cur->vip_prefix_len = atoi(value); } #endif @@ -571,7 +864,9 @@ ini_parse_handler(void* user, const char* section, const char* name, printf("[%s]: %s=%s\n", section, name, value); #define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0 - if (MATCH("dpdk", "channel")) { + if (MATCH("dpdk", "log_level")) { + pconfig->dpdk.log_level = atoi(value); + } else if (MATCH("dpdk", "channel")) { pconfig->dpdk.nb_channel = atoi(value); } else if (MATCH("dpdk", "memory")) { pconfig->dpdk.memory = atoi(value); @@ -602,6 +897,8 @@ ini_parse_handler(void* user, const char* section, const char* name, pconfig->dpdk.tx_csum_offoad_skip = atoi(value); } else if (MATCH("dpdk", "vlan_strip")) { pconfig->dpdk.vlan_strip = atoi(value); + } else if (MATCH("dpdk", "vlan_filter")) { + return parse_vlan_filter_list(pconfig, value); } else if (MATCH("dpdk", "idle_sleep")) { pconfig->dpdk.idle_sleep = atoi(value); } else if (MATCH("dpdk", "pkt_tx_delay")) { @@ -610,6 +907,12 @@ ini_parse_handler(void* user, const char* section, const char* name, pconfig->dpdk.symmetric_rss = atoi(value); } else if (MATCH("kni", "enable")) { pconfig->kni.enable= atoi(value); + } else if (MATCH("kni", "console_packets_ratelimit")) { + pconfig->kni.console_packets_ratelimit= atoi(value); + } else if (MATCH("kni", "general_packets_ratelimit")) { + pconfig->kni.general_packets_ratelimit= atoi(value); + } else if (MATCH("kni", "kernel_packets_ratelimit")) { + pconfig->kni.kernel_packets_ratelimit= atoi(value); } else if (MATCH("kni", "kni_action")) { pconfig->kni.kni_action= strdup(value); } else if (MATCH("kni", "method")) { @@ -634,15 +937,17 @@ ini_parse_handler(void* user, const char* section, const char* name, return freebsd_conf_handler(pconfig, "sysctl", name, value); } else if (strncmp(section, "port", 4) == 0) { return port_cfg_handler(pconfig, section, name, value); + } else if (strncmp(section, "vlan", 4) == 0) { + return vlan_cfg_handler(pconfig, section, name, value); } else if (strncmp(section, "vdev", 4) == 0) { return vdev_cfg_handler(pconfig, section, name, value); } else if (strncmp(section, "bond", 4) == 0) { return bond_cfg_handler(pconfig, section, name, value); } else if (strcmp(section, "pcap") == 0) { if (strcmp(name, "snaplen") == 0) { - pconfig->pcap.snap_len = (uint16_t)atoi(value); + pconfig->pcap.snap_len = (uint16_t)atoi(value); } else if (strcmp(name, "savelen") == 0) { - pconfig->pcap.save_len = (uint32_t)atoi(value); + pconfig->pcap.save_len = (uint32_t)atoi(value); } else if (strcmp(name, "enable") == 0) { pconfig->pcap.enable = (uint16_t)atoi(value); } else if (strcmp(name, "savepath") == 0) { @@ -675,6 +980,10 @@ dpdk_args_setup(struct ff_config *cfg) sprintf(temp, "-m%d", cfg->dpdk.memory); dpdk_argv[n++] = strdup(temp); } + if (cfg->dpdk.log_level) { + sprintf(temp, "--log-level=%d", cfg->dpdk.log_level); + dpdk_argv[n++] = strdup(temp); + } if (cfg->dpdk.proc_type) { sprintf(temp, "--proc-type=%s", cfg->dpdk.proc_type); dpdk_argv[n++] = strdup(temp); @@ -688,8 +997,14 @@ dpdk_args_setup(struct ff_config *cfg) dpdk_argv[n++] = strdup(temp); } if (cfg->dpdk.pci_whitelist) { - sprintf(temp, "--pci-whitelist=%s", cfg->dpdk.pci_whitelist); - dpdk_argv[n++] = strdup(temp); + char* token; + char* rest = cfg->dpdk.pci_whitelist; + + while ((token = strtok_r(rest, ",", &rest))){ + sprintf(temp, "--pci-whitelist=%s", token); + dpdk_argv[n++] = strdup(temp); + } + } if (cfg->dpdk.nb_vdev) { @@ -785,6 +1100,7 @@ dpdk_args_setup(struct ff_config *cfg) for (i=0; idpdk.promiscuous = 1; cfg->dpdk.pkt_tx_delay = BURST_TX_DRAIN_US; + /* KNI ratelimit default disabled */ + //cfg->kni.console_packets_ratelimit = KNI_RATELIMT_CONSOLE; + //cfg->kni.general_packets_ratelimit = KNI_RATELIMT_GENERAL; + //cfg->kni.kernel_packets_ratelimit = KNI_RATELIMT_KERNEL; + cfg->freebsd.hz = 100; cfg->freebsd.physmem = 1048576*256; cfg->freebsd.fd_reserve = 0; @@ -948,7 +1269,16 @@ ff_load_config(int argc, char *const argv[]) ret = ini_parse(ff_global_cfg.filename, ini_parse_handler, &ff_global_cfg); if (ret != 0) { - printf("parse %s failed on line %d\n", ff_global_cfg.filename, ret); + switch(ret) { + case -1: + printf("failed to open file %s\n", ff_global_cfg.filename); + break; + case -2: + printf("failed to allocate memory for config parsing\n"); + break; + default: + printf("parse %s failed on line %d\n", ff_global_cfg.filename, ret); + } return -1; } diff --git a/lib/ff_config.h b/lib/ff_config.h index 37630b1aa..ddcd4d548 100644 --- a/lib/ff_config.h +++ b/lib/ff_config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 THL A29 Limited, a Tencent company. + * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,19 @@ extern "C" { #define DPDK_CONFIG_NUM 16 #define DPDK_CONFIG_MAXLEN 256 #define DPDK_MAX_LCORE 128 +#define DPDK_MAX_VLAN_FILTER 128 #define PCAP_SNAP_MINLEN 94 #define PCAP_SAVE_MINLEN (2<<22) +/* + * KNI ratelimit default value. + * The total speed limit for a single process entering the kni ring is 10,000 QPS, + * 1000 QPS for general packets, 9000 QPS for console packets (ospf/arp, etc.) + * The total speed limit for kni forwarding to the kernel is 20,000 QPS. + */ +#define KNI_RATELIMT_PROCESS (10000) +#define KNI_RATELIMT_GENERAL (1000) +#define KNI_RATELIMT_CONSOLE (KNI_RATELIMT_PROCESS - KNI_RATELIMT_GENERAL) +#define KNI_RATELIMT_KERNEL (KNI_RATELIMT_PROCESS * 2) extern int dpdk_argc; extern char *dpdk_argv[DPDK_CONFIG_NUM + 1]; @@ -44,6 +55,8 @@ extern char *dpdk_argv[DPDK_CONFIG_NUM + 1]; #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ +#define VIP_MAX_NUM 64 + struct ff_hw_features { uint8_t rx_csum; uint8_t rx_lro; @@ -52,30 +65,94 @@ struct ff_hw_features { uint8_t tx_tso; }; +#ifdef FF_IPFW +struct ff_ipfw_pr_cfg { + //uint32_t rule_num; + //uint32_t fib_num; /* Use portN or vlanN's idx * 100 */ + char *addr; + char *netmask; +}; +#endif + +struct ff_vlan_cfg { + char *name; + char *ifname; + /* global vlan idx, also use for route table's fib num */ + int vlan_idx; + uint16_t vlan_id; + uint16_t port_id; + + char *addr; + char *netmask; + char *broadcast; + char *gateway; + + char *vip_ifname; + char *vip_addr_str; + char **vip_addr_array; + uint32_t nb_vip; + + /* simple policy routing, only need rule num(100/200/300/400), ip/mask,fib num(0/1/2/3/4) */ + char *pr_addr_str; + +#ifdef FF_IPFW + struct ff_ipfw_pr_cfg *pr_cfg; + uint32_t nb_pr; +#endif + +#ifdef INET6 + char *addr6_str; + char *gateway6_str; + uint8_t prefix_len; + + char *vip_addr6_str; + char **vip_addr6_array; + uint32_t nb_vip6; + uint8_t vip_prefix_len; +#endif +}; + struct ff_port_cfg { char *name; - uint8_t port_id; + char *ifname; + uint16_t port_id; uint8_t mac[6]; struct ff_hw_features hw_features; + char *addr; char *netmask; char *broadcast; char *gateway; -#ifdef INET6 - char *addr6_str; - char *gateway6_str; - uint8_t prefix_len; + char *vip_ifname; + char *vip_addr_str; + char **vip_addr_array; + uint32_t nb_vip; + +#ifdef FF_IPFW + char *pr_addr_str; + struct ff_ipfw_pr_cfg *pr_cfg; + uint32_t nb_pr; #endif - char *pcap; - uint16_t snaplen; - uint32_t savelen; +#ifdef INET6 + char *addr6_str; + char *gateway6_str; + uint8_t prefix_len; + + char *vip_addr6_str; + char **vip_addr6_array; + uint32_t nb_vip6; + uint8_t vip_prefix_len; +#endif int nb_lcores; int nb_slaves; uint16_t lcore_list[DPDK_MAX_LCORE]; uint16_t *slave_portid_list; + + int nb_vlan; + struct ff_vlan_cfg *vlan_cfgs[DPDK_MAX_VLAN_FILTER]; }; struct ff_vdev_cfg { @@ -141,6 +218,8 @@ struct ff_config { int tso; int tx_csum_offoad_skip; int vlan_strip; + int nb_vlan_filter; + uint16_t vlan_filter_id[DPDK_MAX_VLAN_FILTER]; int symmetric_rss; /* sleep x microseconds when no pkts incomming */ @@ -155,14 +234,21 @@ struct ff_config { int nb_ports; uint16_t max_portid; uint16_t *portid_list; + + // load dpdk log level + uint16_t log_level; // MAP(portid => struct ff_port_cfg*) struct ff_port_cfg *port_cfgs; + struct ff_vlan_cfg *vlan_cfgs; struct ff_vdev_cfg *vdev_cfgs; struct ff_bond_cfg *bond_cfgs; } dpdk; struct { int enable; + int console_packets_ratelimit; + int general_packets_ratelimit; + int kernel_packets_ratelimit; char *kni_action; char *method; char *tcp_port; diff --git a/lib/ff_dpdk_if.c b/lib/ff_dpdk_if.c index 50d3b1276..bbafcb353 100644 --- a/lib/ff_dpdk_if.c +++ b/lib/ff_dpdk_if.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 THL A29 Limited, a Tencent company. + * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,6 +78,7 @@ static int numa_on; static unsigned idle_sleep; static unsigned pkt_tx_delay; +static uint64_t usr_cb_tsc; static struct rte_timer freebsd_clock; @@ -357,7 +358,7 @@ init_mem_pool(void) } else { printf("create mbuf pool on socket %d\n", socketid); } - + #ifdef FF_USE_PAGE_ARRAY nb_mbuf = RTE_ALIGN_CEIL ( nb_ports*nb_lcores*MAX_PKT_BURST + @@ -657,6 +658,21 @@ init_port_start(void) if (ff_global_cfg.dpdk.vlan_strip) { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + printf("RX vlan strip offload supported\n"); + } + } + + /* + * Set Rx VLAN filter, and then the dirvier(such as MLX5) will set + * FLOW RSS to enable L3/L4 RSS below vlan hdr. + * This action won't need after DPDK-20.11. + */ + if (ff_global_cfg.dpdk.nb_vlan_filter) { + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_FILTER) { + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + printf("RX vlan filter offload supported\n"); + } else { + printf("RX vlan filter offload not supported\n"); } } @@ -704,6 +720,9 @@ init_port_start(void) port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO; pconf->hw_features.tx_tso = 1; } + else { + printf("TSO is not supported\n"); + } } else { printf("TSO is disabled\n"); } @@ -726,6 +745,24 @@ init_port_start(void) return ret; } + /* Enable vlan filter for RSS */ + if (ff_global_cfg.dpdk.nb_vlan_filter) { + uint16_t vlan_id ; + int on = 1, vlan_idx; + + for (vlan_idx = 0; vlan_idx < ff_global_cfg.dpdk.nb_vlan_filter; vlan_idx++) { + vlan_id = ff_global_cfg.dpdk.vlan_filter_id[vlan_idx]; + + if (rte_eth_dev_vlan_filter(port_id, vlan_id, on)) { + printf("Port %u set vlan filter id %u on %d failed.\n", + port_id, vlan_id, on); + } else { + printf("Port %u set vlan filter id %u on %d success.\n", + port_id, vlan_id, on); + } + } + } + static uint16_t nb_rxd = RX_QUEUE_SIZE; static uint16_t nb_txd = TX_QUEUE_SIZE; ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd); @@ -736,7 +773,7 @@ init_port_start(void) uint16_t q; for (q = 0; q < nb_queues; q++) { if (numa_on) { - uint16_t lcore_id = lcore_conf.port_cfgs[port_id].lcore_list[q]; + uint16_t lcore_id = lcore_conf.port_cfgs[u_port_id].lcore_list[q]; socketid = rte_lcore_to_socket_id(lcore_id); } mbuf_pool = pktmbuf_pool[socketid]; @@ -792,8 +829,8 @@ init_port_start(void) if (ret < 0) { return ret; } - //RSS reta update will failed when enable flow isolate - #ifndef FF_FLOW_ISOLATE +//RSS reta update will failed when enable flow isolate +#ifndef FF_FLOW_ISOLATE if (nb_queues > 1) { /* set HW rss hash function to Toeplitz. */ if (!rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_HASH)) { @@ -810,7 +847,7 @@ init_port_start(void) set_rss_table(port_id, dev_info.reta_size, nb_queues); } - #endif +#endif /* Enable RX in promiscuous mode for the Ethernet device. */ if (ff_global_cfg.dpdk.promiscuous) { @@ -848,7 +885,7 @@ init_clock(void) return 0; } -#ifdef FF_FLOW_ISOLATE +#if defined(FF_FLOW_ISOLATE) || defined(FF_FDIR) /** Print a message out of a flow error. */ static int port_flow_complain(struct rte_flow_error *error) @@ -875,7 +912,7 @@ port_flow_complain(struct rte_flow_error *error) const char *errstr; char buf[32]; int err = rte_errno; - + if ((unsigned int)error->type >= RTE_DIM(errstrlist) || !errstrlist[error->type]) errstr = "unknown type"; @@ -889,12 +926,15 @@ port_flow_complain(struct rte_flow_error *error) rte_strerror(err)); return -err; } +#endif + +#ifdef FF_FLOW_ISOLATE static int port_flow_isolate(uint16_t port_id, int set) { struct rte_flow_error error; - + /* Poisoning to make sure PMDs update it in case of error. */ memset(&error, 0x66, sizeof(error)); if (rte_flow_isolate(port_id, set, &error)) @@ -1055,6 +1095,110 @@ init_flow(uint16_t port_id, uint16_t tcp_port) { #endif +#ifdef FF_FDIR +/* + * Flow director allows the traffic to specific port to be processed on the + * specific queue. Unlike FF_FLOW_ISOLATE, the FF_FDIR implementation uses + * general flow rule so that most FDIR supported NIC will support. The best + * using case of FDIR is (but not limited to), using multiple processes to + * listen on different ports. + * + * This function can be called either in FSTACK or in end-application. + * + * Example: + * Given 2 fstack instances A and B. Instance A listens on port 80, and + * instance B listens on port 81. We want to process the traffic to port 80 + * on rx queue 0, and the traffic to port 81 on rx queue 1. + * // port 80 rx queue 0 + * ret = fdir_add_tcp_flow(port_id, 0, FF_FLOW_INGRESS, 0, 80); + * // port 81 rx queue 1 + * ret = fdir_add_tcp_flow(port_id, 1, FF_FLOW_INGRESS, 0, 81); + */ +#define FF_FLOW_EGRESS 1 +#define FF_FLOW_INGRESS 2 +/** + * Create a flow rule that moves packets with matching src and dest tcp port + * to the target queue. + * + * This function uses general flow rules and doesn't rely on the flow_isolation + * that not all the FDIR capable NIC support. + * + * @param port_id + * The selected port. + * @param queue + * The target queue. + * @param dir + * The direction of the traffic. + * 1 for egress, 2 for ingress and sum(1+2) for both. + * @param tcp_sport + * The src tcp port to match. + * @param tcp_dport + * The dest tcp port to match. + * + */ +static int +fdir_add_tcp_flow(uint16_t port_id, uint16_t queue, uint16_t dir, + uint16_t tcp_sport, uint16_t tcp_dport) +{ + struct rte_flow_attr attr; + struct rte_flow_item flow_pattern[4]; + struct rte_flow_action flow_action[2]; + struct rte_flow *flow = NULL; + struct rte_flow_action_queue flow_action_queue = { .index = queue }; + struct rte_flow_item_tcp tcp_spec; + struct rte_flow_item_tcp tcp_mask; + struct rte_flow_error rfe; + int res; + + memset(flow_pattern, 0, sizeof(flow_pattern)); + memset(flow_action, 0, sizeof(flow_action)); + + /* + * set the rule attribute. + */ + memset(&attr, 0, sizeof(struct rte_flow_attr)); + attr.ingress = ((dir & FF_FLOW_INGRESS) > 0); + attr.egress = ((dir & FF_FLOW_EGRESS) > 0); + + /* + * create the action sequence. + * one action only, move packet to queue + */ + flow_action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE; + flow_action[0].conf = &flow_action_queue; + flow_action[1].type = RTE_FLOW_ACTION_TYPE_END; + + flow_pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; + flow_pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4; + + /* + * set the third level of the pattern (TCP). + */ + memset(&tcp_spec, 0, sizeof(struct rte_flow_item_tcp)); + memset(&tcp_mask, 0, sizeof(struct rte_flow_item_tcp)); + tcp_spec.hdr.src_port = htons(tcp_sport); + tcp_mask.hdr.src_port = (tcp_sport == 0 ? 0: 0xffff); + tcp_spec.hdr.dst_port = htons(tcp_dport); + tcp_mask.hdr.dst_port = (tcp_dport == 0 ? 0: 0xffff); + flow_pattern[2].type = RTE_FLOW_ITEM_TYPE_TCP; + flow_pattern[2].spec = &tcp_spec; + flow_pattern[2].mask = &tcp_mask; + + flow_pattern[3].type = RTE_FLOW_ITEM_TYPE_END; + + res = rte_flow_validate(port_id, &attr, flow_pattern, flow_action, &rfe); + if (res) + return (1); + + flow = rte_flow_create(port_id, &attr, flow_pattern, flow_action, &rfe); + if (!flow) + return port_flow_complain(&rfe); + + return (0); +} + +#endif + int ff_dpdk_init(int argc, char **argv) { @@ -1097,8 +1241,8 @@ ff_dpdk_init(int argc, char **argv) #ifdef FF_USE_PAGE_ARRAY ff_mmap_init(); #endif - -#ifdef FF_FLOW_ISOLATE + +#ifdef FF_FLOW_ISOLATE // run once in primary process if (0 == lcore_conf.tx_queue_id[0]){ ret = port_flow_isolate(0, 1); @@ -1106,7 +1250,7 @@ ff_dpdk_init(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_port_isolate failed\n"); } #endif - + ret = init_port_start(); if (ret < 0) { rte_exit(EXIT_FAILURE, "init_port_start failed\n"); @@ -1114,8 +1258,8 @@ ff_dpdk_init(int argc, char **argv) init_clock(); #ifdef FF_FLOW_ISOLATE - //Only give a example usage: port_id=0, tcp_port= 80. - //Recommend: + //Only give a example usage: port_id=0, tcp_port= 80. + //Recommend: //1. init_flow should replace `set_rss_table` in `init_port_start` loop, This can set all NIC's port_id_list instead only 0 device(port_id). //2. using config options `tcp_port` replace magic number of 80 ret = init_flow(0, 80); @@ -1123,6 +1267,16 @@ ff_dpdk_init(int argc, char **argv) rte_exit(EXIT_FAILURE, "init_port_flow failed\n"); } #endif + +#ifdef FF_FDIR + /* + * Refer function header section for usage. + */ + ret = fdir_add_tcp_flow(0, 0, FF_FLOW_INGRESS, 0, 80); + if (ret) + rte_exit(EXIT_FAILURE, "fdir_add_tcp_flow failed\n"); +#endif + return 0; } @@ -1189,10 +1343,17 @@ protocol_filter(const void *data, uint16_t len) len -= sizeof(struct rte_vlan_hdr); } - if(ether_type == RTE_ETHER_TYPE_ARP) + if(ether_type == RTE_ETHER_TYPE_ARP) { return FILTER_ARP; + } -#ifdef INET6 + /* Multicast protocol, such as stp(used by zebra), is forwarded to kni and has a separate speed limit */ + if (rte_is_multicast_ether_addr(&hdr->d_addr)) { + return FILTER_MULTI; + } + +#if (!defined(__FreeBSD__) && defined(INET6) ) || \ + ( defined(__FreeBSD__) && defined(INET6) && defined(FF_KNI)) if (ether_type == RTE_ETHER_TYPE_IPV6) { return ff_kni_proto_filter(data, len, ether_type); @@ -1274,6 +1435,24 @@ pktmbuf_deep_clone(const struct rte_mbuf *md, return mc; } +static inline void +ff_add_vlan_tag(struct rte_mbuf * rtem) +{ + void *data = NULL; + + if (rtem->ol_flags & PKT_RX_VLAN_STRIPPED) { + data = rte_pktmbuf_prepend(rtem, sizeof(struct rte_vlan_hdr)); + if (data != NULL) { + memmove(data, data + sizeof(struct rte_vlan_hdr), RTE_ETHER_HDR_LEN); + struct rte_ether_hdr *etherhdr = (struct rte_ether_hdr *)data; + struct rte_vlan_hdr *vlanhdr = (struct rte_vlan_hdr *)(data + RTE_ETHER_HDR_LEN); + vlanhdr->vlan_tci = rte_cpu_to_be_16(rtem->vlan_tci); + vlanhdr->eth_proto = etherhdr->ether_type; + etherhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); + } + } +} + static inline void process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs, uint16_t count, const struct ff_dpdk_if_context *ctx, int pkts_from_ring) @@ -1295,29 +1474,20 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs, uint16_t len = rte_pktmbuf_data_len(rtem); if (!pkts_from_ring) { - ff_traffic.rx_packets++; - ff_traffic.rx_bytes += len; + ff_traffic.rx_packets += rtem->nb_segs; + ff_traffic.rx_bytes += rte_pktmbuf_pkt_len(rtem); } if (!pkts_from_ring && packet_dispatcher) { + uint64_t cur_tsc = rte_rdtsc(); int ret = (*packet_dispatcher)(data, &len, queue_id, nb_queues); + usr_cb_tsc += rte_rdtsc() - cur_tsc; if (ret == FF_DISPATCH_RESPONSE) { rte_pktmbuf_pkt_len(rtem) = rte_pktmbuf_data_len(rtem) = len; - /* * We have not support vlan out strip */ - if (rtem->vlan_tci) { - data = rte_pktmbuf_prepend(rtem, sizeof(struct rte_vlan_hdr)); - if (data != NULL) { - memmove(data, data + sizeof(struct rte_vlan_hdr), RTE_ETHER_HDR_LEN); - struct rte_ether_hdr *etherhdr = (struct rte_ether_hdr *)data; - struct rte_vlan_hdr *vlanhdr = (struct rte_vlan_hdr *)(data + RTE_ETHER_HDR_LEN); - vlanhdr->vlan_tci = rte_cpu_to_be_16(rtem->vlan_tci); - vlanhdr->eth_proto = etherhdr->ether_type; - etherhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); - } - } + ff_add_vlan_tag(rtem); send_single_packet(rtem, port_id); continue; } @@ -1371,7 +1541,8 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs, mbuf_pool = pktmbuf_pool[qconf->socket_id]; mbuf_clone = pktmbuf_deep_clone(rtem, mbuf_pool); if(mbuf_clone) { - ff_kni_enqueue(port_id, mbuf_clone); + ff_add_vlan_tag(mbuf_clone); + ff_kni_enqueue(filter, port_id, mbuf_clone); } } #endif @@ -1379,14 +1550,16 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs, #ifdef FF_KNI } else if (enable_kni) { if (knictl_action == FF_KNICTL_ACTION_ALL_TO_KNI){ - ff_kni_enqueue(port_id, rtem); + ff_add_vlan_tag(rtem); + ff_kni_enqueue(filter, port_id, rtem); } else if (knictl_action == FF_KNICTL_ACTION_ALL_TO_FF){ ff_veth_input(ctx, rtem); } else if (knictl_action == FF_KNICTL_ACTION_DEFAULT){ if (enable_kni && ((filter == FILTER_KNI && kni_accept) || - (filter == FILTER_UNKNOWN && !kni_accept)) ) { - ff_kni_enqueue(port_id, rtem); + ((filter == FILTER_UNKNOWN || filter >= FILTER_OSPF) && !kni_accept)) ) { + ff_add_vlan_tag(rtem); + ff_kni_enqueue(filter, port_id, rtem); } else { ff_veth_input(ctx, rtem); } @@ -1413,7 +1586,7 @@ process_dispatch_ring(uint16_t port_id, uint16_t queue_id, process_packets(port_id, queue_id, pkts_burst, nb_rb, ctx, 1); } - return 0; + return nb_rb; } static inline void @@ -1511,7 +1684,7 @@ handle_ipfw_msg(struct ff_msg *msg) case FF_IPFW_SET: ret = ff_setsockopt_freebsd(fd, msg->ipfw.level, msg->ipfw.optname, msg->ipfw.optval, - *(msg->ipfw.optlen)); + *(msg->ipfw.optlen)); break; default: ret = -1; @@ -1537,6 +1710,11 @@ handle_traffic_msg(struct ff_msg *msg) msg->result = 0; } +void ff_get_traffic(void *buffer) +{ + *(struct ff_traffic_args *)buffer = ff_traffic; +} + #ifdef FF_KNI static inline void handle_knictl_msg(struct ff_msg *msg) @@ -1650,11 +1828,11 @@ send_burst(struct lcore_conf *qconf, uint16_t n, uint8_t port) if (unlikely(ff_global_cfg.pcap.enable)) { uint16_t i; for (i = 0; i < n; i++) { - ff_dump_packets( ff_global_cfg.pcap.save_path, m_table[i], + ff_dump_packets( ff_global_cfg.pcap.save_path, m_table[i], ff_global_cfg.pcap.snap_len, ff_global_cfg.pcap.save_len); } } - + ret = rte_eth_tx_burst(port, queueid, m_table, n); ff_traffic.tx_packets += ret; uint16_t i; @@ -1664,7 +1842,7 @@ send_burst(struct lcore_conf *qconf, uint16_t n, uint8_t port) if (qconf->tx_mbufs[port].bsd_m_table[i]) ff_enq_tx_bsdmbuf(port, qconf->tx_mbufs[port].bsd_m_table[i], m_table[i]->nb_segs); #endif - } + } if (unlikely(ret < n)) { do { rte_pktmbuf_free(m_table[ret]); @@ -1706,7 +1884,7 @@ ff_dpdk_if_send(struct ff_dpdk_if_context *ctx, void *m, #ifdef FF_USE_PAGE_ARRAY struct lcore_conf *qconf = &lcore_conf; int len = 0; - + len = ff_if_send_onepkt(ctx, m,total); if (unlikely(len == MAX_PKT_BURST)) { send_burst(qconf, MAX_PKT_BURST, ctx->port_id); @@ -1827,6 +2005,48 @@ ff_dpdk_if_send(struct ff_dpdk_if_context *ctx, void *m, return send_single_packet(head, ctx->port_id); } +int +ff_dpdk_raw_packet_send(void *data, int total, uint16_t port_id) +{ + struct rte_mempool *mbuf_pool = pktmbuf_pool[lcore_conf.socket_id]; + struct rte_mbuf *head = rte_pktmbuf_alloc(mbuf_pool); + if (head == NULL) { + return -1; + } + + head->pkt_len = total; + head->nb_segs = 0; + + int off = 0; + struct rte_mbuf *cur = head, *prev = NULL; + while(total > 0) { + if (cur == NULL) { + cur = rte_pktmbuf_alloc(mbuf_pool); + if (cur == NULL) { + rte_pktmbuf_free(head); + return -1; + } + } + + if (prev != NULL) { + prev->next = cur; + } + head->nb_segs++; + + prev = cur; + void *cur_data = rte_pktmbuf_mtod(cur, void*); + int len = total > RTE_MBUF_DEFAULT_DATAROOM ? RTE_MBUF_DEFAULT_DATAROOM : total; + memcpy(cur_data, data + off, len); + + cur->data_len = len; + off += len; + total -= len; + cur = NULL; + } + + return send_single_packet(head, port_id); +} + static int main_loop(void *arg) { @@ -1853,11 +2073,40 @@ main_loop(void *arg) cur_tsc = rte_rdtsc(); if (unlikely(freebsd_clock.expire < cur_tsc)) { rte_timer_manage(); + +#ifdef FF_KNI + /* reset kni ratelimt */ + if (enable_kni && + (ff_global_cfg.kni.console_packets_ratelimit || + ff_global_cfg.kni.general_packets_ratelimit || + ff_global_cfg.kni.kernel_packets_ratelimit)) { + static time_t last_sec = 0; + time_t sec; + long nsec; + + ff_get_current_time(&sec, &nsec); + if (sec > last_sec) { + if (kni_rate_limt.gerneal_packets > ff_global_cfg.kni.general_packets_ratelimit || + kni_rate_limt.console_packets > ff_global_cfg.kni.console_packets_ratelimit || + kni_rate_limt.kernel_packets > ff_global_cfg.kni.kernel_packets_ratelimit) { + printf("kni ratelimit, general:%lu/%d, console:%lu/%d, kernel:%lu/%d, last sec:%ld, sec:%ld\n", + kni_rate_limt.gerneal_packets, ff_global_cfg.kni.general_packets_ratelimit, + kni_rate_limt.console_packets, ff_global_cfg.kni.console_packets_ratelimit, + kni_rate_limt.kernel_packets, ff_global_cfg.kni.kernel_packets_ratelimit, last_sec, sec); + } + last_sec = sec; + kni_rate_limt.gerneal_packets = 0; + kni_rate_limt.console_packets = 0; + kni_rate_limt.kernel_packets = 0; + } + } +#endif } idle = 1; sys_tsc = 0; usr_tsc = 0; + usr_cb_tsc = 0; /* * TX burst queue drain @@ -1894,7 +2143,7 @@ main_loop(void *arg) } #endif - process_dispatch_ring(port_id, queue_id, pkts_burst, ctx); + idle &= !process_dispatch_ring(port_id, queue_id, pkts_burst, ctx); nb_rx = rte_eth_rx_burst(port_id, queue_id, pkts_burst, MAX_PKT_BURST); @@ -1939,12 +2188,13 @@ main_loop(void *arg) end_tsc = idle_sleep_tsc; } + usr_tsc = usr_cb_tsc; if (usch_tsc == cur_tsc) { - usr_tsc = idle_sleep_tsc - div_tsc; + usr_tsc += idle_sleep_tsc - div_tsc; } if (!idle) { - sys_tsc = div_tsc - cur_tsc; + sys_tsc = div_tsc - cur_tsc - usr_cb_tsc; ff_top_status.sys_tsc += sys_tsc; } diff --git a/lib/ff_dpdk_kni.c b/lib/ff_dpdk_kni.c index cd658ec92..0aab47eae 100644 --- a/lib/ff_dpdk_kni.c +++ b/lib/ff_dpdk_kni.c @@ -42,6 +42,10 @@ #include "ff_dpdk_kni.h" #include "ff_config.h" +#ifndef IPPROTO_OSPFIGP +#define IPPROTO_OSPFIGP 89 /**< OSPFIGP */ +#endif + /* Callback for request of changing MTU */ /* Total octets in ethernet header */ #define KNI_ENET_HEADER_SIZE 14 @@ -81,6 +85,8 @@ struct kni_interface_stats { struct rte_ring **kni_rp; struct kni_interface_stats **kni_stat; +struct kni_ratelimit kni_rate_limt = {0, 0, 0}; + static void set_bitmap(uint16_t port, unsigned char *bitmap) { @@ -160,7 +166,7 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) } if (ret < 0) - printf("Failed to Configure network interface of %d %s\n", + printf("Failed to Configure network interface of %d %s\n", port_id, if_up ? "up" : "down"); return ret; @@ -201,15 +207,30 @@ kni_process_tx(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **pkts_burst, unsigned count) { /* read packet from kni ring(phy port) and transmit to kni */ - uint16_t nb_tx, nb_kni_tx; + uint16_t nb_tx, nb_to_tx, nb_kni_tx; nb_tx = rte_ring_dequeue_burst(kni_rp[port_id], (void **)pkts_burst, count, NULL); + /* + * The total ratelimit forwarded to the kernel, may a few more packets being sent, but it doesn’t matter, + * If there are too many processes, there is also the possibility that the control packet will be ratelimited. + */ + if (ff_global_cfg.kni.kernel_packets_ratelimit) { + if (likely(kni_rate_limt.kernel_packets < ff_global_cfg.kni.kernel_packets_ratelimit)) { + nb_to_tx = nb_tx; + } else { + nb_to_tx = 0; + } + kni_rate_limt.kernel_packets += nb_tx; + } else { + nb_to_tx = nb_tx; + } + /* NB. * if nb_tx is 0,it must call rte_kni_tx_burst * must Call regularly rte_kni_tx_burst(kni, NULL, 0). * detail https://embedded.communities.intel.com/thread/6668 */ - nb_kni_tx = rte_kni_tx_burst(kni_stat[port_id]->kni, pkts_burst, nb_tx); + nb_kni_tx = rte_kni_tx_burst(kni_stat[port_id]->kni, pkts_burst, nb_to_tx); rte_kni_handle_request(kni_stat[port_id]->kni); if(nb_kni_tx < nb_tx) { uint16_t i; @@ -385,22 +406,28 @@ protocol_filter_ip(const void *data, uint16_t len, uint16_t eth_frame_type) next_len = len - hdr_len; switch (proto) { +#ifdef FF_KNI + /* The opsf protocol is forwarded to kni and the ratelimited separately */ + case IPPROTO_OSPFIGP: + return FILTER_OSPF; +#endif + case IPPROTO_TCP: #ifdef FF_KNI if (!enable_kni) - break; -#else - break; #endif + break; + return protocol_filter_tcp(next, next_len); + case IPPROTO_UDP: #ifdef FF_KNI if (!enable_kni) - break; -#else - break; #endif + break; + return protocol_filter_udp(next, next_len); + case IPPROTO_IPIP: return protocol_filter_ip(next, next_len, RTE_ETHER_TYPE_IPV4); #ifdef INET6 @@ -507,7 +534,7 @@ ff_kni_alloc(uint16_t port_id, unsigned socket_id, conf.addr = pci_dev->addr; conf.id = pci_dev->id; } - + /* Get the interface default mac address */ rte_eth_macaddr_get(port_id, (struct rte_ether_addr *)&conf.mac_addr); @@ -534,7 +561,7 @@ ff_kni_alloc(uint16_t port_id, unsigned socket_id, snprintf((char*)ring_name, RTE_KNI_NAMESIZE, "kni_ring_%u", port_id); if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - kni_rp[port_id] = rte_ring_create(ring_name, ring_queue_size, + kni_rp[port_id] = rte_ring_create(ring_name, ring_queue_size, socket_id, RING_F_SC_DEQ); if (rte_ring_lookup(ring_name) != kni_rp[port_id]) @@ -560,12 +587,34 @@ ff_kni_process(uint16_t port_id, uint16_t queue_id, /* enqueue the packet, and own it */ int -ff_kni_enqueue(uint16_t port_id, struct rte_mbuf *pkt) +ff_kni_enqueue(enum FilterReturn filter, uint16_t port_id, struct rte_mbuf *pkt) { + if (filter >= FILTER_ARP) { + if (ff_global_cfg.kni.console_packets_ratelimit) { + kni_rate_limt.console_packets++; + if (kni_rate_limt.console_packets > ff_global_cfg.kni.console_packets_ratelimit) { + goto error; + } + } + } else { + if (ff_global_cfg.kni.general_packets_ratelimit) { + kni_rate_limt.gerneal_packets++; + if (kni_rate_limt.gerneal_packets > ff_global_cfg.kni.general_packets_ratelimit) { + goto error; + } + } + } + int ret = rte_ring_enqueue(kni_rp[port_id], pkt); - if (ret < 0) - rte_pktmbuf_free(pkt); + if (ret < 0) { + goto error; + } return 0; + +error: + rte_pktmbuf_free(pkt); + + return -1; } diff --git a/lib/ff_dpdk_kni.h b/lib/ff_dpdk_kni.h index 2ddf7a0de..dbe36ceb6 100644 --- a/lib/ff_dpdk_kni.h +++ b/lib/ff_dpdk_kni.h @@ -33,13 +33,28 @@ extern int enable_kni; +struct kni_ratelimit { + /* Important control plane packets enqueue to kni ring, such as arp, stp, ospf, etc. statistics for each process. */ + uint64_t console_packets; + + /* gerneal packets enqueue to kni ring, such ICMP pkts, statistics for each process. */ + uint64_t gerneal_packets; + + /* All packets forwarded to the kernel, statistics for primary process. */ + uint64_t kernel_packets; +}; + +extern struct kni_ratelimit kni_rate_limt; + enum FilterReturn { FILTER_UNKNOWN = -1, - FILTER_ARP = 1, - FILTER_KNI = 2, + FILTER_KNI = 1, + FILTER_ARP = 2, #ifdef INET6 FILTER_NDP = 3, // Neighbor Solicitation/Advertisement, Router Solicitation/Advertisement/Redirect #endif + FILTER_OSPF = 4, + FILTER_MULTI = 5, }; void ff_kni_init(uint16_t nb_ports, const char *tcp_ports, @@ -53,7 +68,7 @@ void ff_kni_process(uint16_t port_id, uint16_t queue_id, enum FilterReturn ff_kni_proto_filter(const void *data, uint16_t len, uint16_t eth_frame_type); -int ff_kni_enqueue(uint16_t port_id, struct rte_mbuf *pkt); +int ff_kni_enqueue(enum FilterReturn filter, uint16_t port_id, struct rte_mbuf *pkt); #endif /* ifndef _FSTACK_DPDK_KNI_H */ diff --git a/lib/ff_freebsd_init.c b/lib/ff_freebsd_init.c index 28b9ec86b..f247d4720 100644 --- a/lib/ff_freebsd_init.c +++ b/lib/ff_freebsd_init.c @@ -79,7 +79,7 @@ int lo_set_defaultaddr(void) char *netmask="255.0.0.0"; struct ifnet *ifp=NULL; int ret; - + IFNET_WLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) if ( (ifp->if_flags & IFF_LOOPBACK) != 0 ) @@ -88,16 +88,16 @@ int lo_set_defaultaddr(void) if(ifp == NULL) return -1; - + bzero(&req, sizeof req); strcpy(req.ifra_name, ifp->if_xname); - + struct sockaddr_in sa; bzero(&sa, sizeof(sa)); - + sa.sin_len = sizeof(sa); sa.sin_family = AF_INET; - + inet_pton(AF_INET, addr, &sa.sin_addr.s_addr); bcopy(&sa, &req.ifra_addr, sizeof(sa)); @@ -113,7 +113,7 @@ int lo_set_defaultaddr(void) return ret; ret = ifioctl(so, SIOCAIFADDR, (caddr_t)&req, curthread); - sofree(so); + soclose(so); return ret; } diff --git a/lib/ff_ini_parser.h b/lib/ff_ini_parser.h index 16aa4e9df..2a610c210 100644 --- a/lib/ff_ini_parser.h +++ b/lib/ff_ini_parser.h @@ -83,7 +83,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, /* Maximum line length for any line in INI file. */ #ifndef INI_MAX_LINE -#define INI_MAX_LINE 200 +#define INI_MAX_LINE 2048 #endif #ifdef __cplusplus diff --git a/lib/ff_syscall_wrapper.c b/lib/ff_syscall_wrapper.c index 1bcfecacc..e47f12d58 100644 --- a/lib/ff_syscall_wrapper.c +++ b/lib/ff_syscall_wrapper.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2010 Kip Macy. All rights reserved. - * Copyright (C) 2017 THL A29 Limited, a Tencent company. + * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,6 +87,10 @@ #define LINUX_IP_TTL 2 #define LINUX_IP_HDRINCL 3 #define LINUX_IP_OPTIONS 4 +#define LINUX_IP_RECVTTL 12 +#define LINUX_IP_RECVTOS 13 +#define LINUX_IP_TRANSPARENT 19 +#define LINUX_IP_MINTTL 21 #define LINUX_IP_MULTICAST_IF 32 #define LINUX_IP_MULTICAST_TTL 33 @@ -94,6 +98,10 @@ #define LINUX_IP_ADD_MEMBERSHIP 35 #define LINUX_IP_DROP_MEMBERSHIP 36 +#define LINUX_IPV6_V6ONLY 26 +#define LINUX_IPV6_RECVPKTINFO 49 +#define LINUX_IPV6_TRANSPARENT 75 + #define LINUX_TCP_NODELAY 1 #define LINUX_TCP_MAXSEG 2 #define LINUX_TCP_KEEPIDLE 4 @@ -176,6 +184,9 @@ /* msghdr define start */ +static /*__thread*/ struct iovec msg_iov_tmp[UIO_MAXIOV]; +static /*__thread*/ size_t msg_iovlen_tmp; + struct linux_msghdr { void *msg_name; /* Address to send to/receive from. */ socklen_t msg_namelen; /* Length of address data. */ @@ -194,6 +205,44 @@ struct linux_msghdr { /* msghdr define end */ +/* cmsghdr define start */ + +struct linux_cmsghdr +{ + size_t cmsg_len; /* Length of data in cmsg_data plus length + of cmsghdr structure. + !! The type should be socklen_t but the + definition of the kernel is incompatible + with this. */ + int cmsg_level; /* Originating protocol. */ + int cmsg_type; /* Protocol specific type. */ +}; + +/* + * LINUX_CMSG_XXXX has the same effect as FreeBSD's CMSG_XXXX, + * because aligned to 8 bytes, but still redefine them. + */ +#define LINUX_CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \ + _ALIGN(sizeof(struct linux_cmsghdr))) +#define LINUX_CMSG_SPACE(l) (_ALIGN(sizeof(struct linux_cmsghdr)) + _ALIGN(l)) +#define LINUX_CMSG_LEN(l) (_ALIGN(sizeof(struct linux_cmsghdr)) + (l)) + +#define LINUX_CMSG_FIRSTHDR(mhdr) \ + ((mhdr)->msg_controllen >= sizeof(struct linux_cmsghdr) ? \ + (struct linux_cmsghdr *)(mhdr)->msg_control : \ + (struct linux_cmsghdr *)0) + +#define LINUX_CMSG_NXTHDR(mhdr, cmsg) \ + ((char *)(cmsg) == (char *)0 ? LINUX_CMSG_FIRSTHDR(mhdr) : \ + ((char *)(cmsg) + _ALIGN(((struct linux_cmsghdr *)(cmsg))->cmsg_len) + \ + _ALIGN(sizeof(struct linux_cmsghdr)) > \ + (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct linux_cmsghdr *)0 : \ + (struct linux_cmsghdr *)(void *)((char *)(cmsg) + \ + _ALIGN(((struct linux_cmsghdr *)(cmsg))->cmsg_len))) + +/* cmsghdr define end */ + extern int sendit(struct thread *td, int s, struct msghdr *mp, int flags); static long @@ -377,7 +426,30 @@ ip_opt_convert(int optname) case LINUX_IP_ADD_MEMBERSHIP: return IP_ADD_MEMBERSHIP; case LINUX_IP_DROP_MEMBERSHIP: - return IP_DROP_MEMBERSHIP; + return IP_DROP_MEMBERSHIP; + case LINUX_IP_RECVTTL: + return IP_RECVTTL; + case LINUX_IP_RECVTOS: + return IP_RECVTOS; + case LINUX_IP_TRANSPARENT: + return IP_BINDANY; + case LINUX_IP_MINTTL: + return IP_MINTTL; + default: + return optname; + } +} + +static int +ip6_opt_convert(int optname) +{ + switch(optname) { + case LINUX_IPV6_V6ONLY: + return IPV6_V6ONLY; + case LINUX_IPV6_RECVPKTINFO: + return IPV6_RECVPKTINFO; + case LINUX_IPV6_TRANSPARENT: + return IPV6_BINDANY; default: return optname; } @@ -414,6 +486,8 @@ linux2freebsd_opt(int level, int optname) return so_opt_convert(optname); case IPPROTO_IP: return ip_opt_convert(optname); + case IPPROTO_IPV6: + return ip6_opt_convert(optname); case IPPROTO_TCP: return tcp_opt_convert(optname); default: @@ -425,7 +499,7 @@ static void linux2freebsd_sockaddr(const struct linux_sockaddr *linux, socklen_t addrlen, struct sockaddr *freebsd) { - if (linux == NULL) { + if (linux == NULL || freebsd == NULL) { return; } @@ -433,20 +507,211 @@ linux2freebsd_sockaddr(const struct linux_sockaddr *linux, freebsd->sa_family = linux->sa_family == LINUX_AF_INET6 ? AF_INET6 : linux->sa_family; freebsd->sa_len = addrlen; - bcopy(linux->sa_data, freebsd->sa_data, addrlen - sizeof(linux->sa_family)); + if (linux->sa_data != freebsd->sa_data) { + bcopy(linux->sa_data, freebsd->sa_data, addrlen - sizeof(linux->sa_family)); + } } static void freebsd2linux_sockaddr(struct linux_sockaddr *linux, struct sockaddr *freebsd) { - if (linux == NULL) { + if (linux == NULL || freebsd == NULL) { return; } + /* #linux and #freebsd may point to the same address */ + if (linux->sa_data != freebsd->sa_data) { + bcopy(freebsd->sa_data, linux->sa_data, freebsd->sa_len - sizeof(linux->sa_family)); + } linux->sa_family = freebsd->sa_family == AF_INET6 ? LINUX_AF_INET6 : freebsd->sa_family; +} + +static inline int +freebsd2linux_cmsghdr(struct linux_msghdr *linux_msg, const struct msghdr *freebsd_msg) +{ + struct cmsghdr *freebsd_cmsg = CMSG_FIRSTHDR(freebsd_msg); + struct linux_cmsghdr *linux_cmsg = LINUX_CMSG_FIRSTHDR(linux_msg); + + while (freebsd_cmsg && linux_cmsg) { + unsigned char *freebsd_optval = CMSG_DATA(freebsd_cmsg); + unsigned char *linux_optval = LINUX_CMSG_DATA(linux_cmsg); + + /* + * The address of linux_cmsg and freebsd_cmsg coincides while recvmsg, + * but the position of the variable pointer is different, + * and the assignment must be reversed. + * + * Although sizeof(struct linux_msghdr) and sizeof(struct msghdr) have different lengths, + * but cmsg_data both skip the same 16 bytes,both aligned to 8 bytes. + */ + linux_cmsg->cmsg_type = freebsd_cmsg->cmsg_type; + linux_cmsg->cmsg_level = freebsd_cmsg->cmsg_level; + linux_cmsg->cmsg_len = LINUX_CMSG_LEN(freebsd_cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))); + + /* + * The freebsd_msg's cmsg_level and cmsg_type has been moddied while recvmsg, + * must use linux_cmsg to judge and calculate data length. + * And don't copy other the bytes that used aligned. + */ + switch (linux_cmsg->cmsg_level) { + case IPPROTO_IP: + switch (linux_cmsg->cmsg_type) { + case IP_RECVTOS: + linux_cmsg->cmsg_type = LINUX_IP_TOS; + *linux_optval = *freebsd_optval; + break; + case IP_RECVTTL: + linux_cmsg->cmsg_len = LINUX_CMSG_LEN(sizeof(int)); + linux_cmsg->cmsg_type = LINUX_IP_TTL; + *(int *)linux_optval = *freebsd_optval; + break; + /*case XXXX: + break;*/ + default: + memcpy(linux_optval, freebsd_optval, linux_cmsg->cmsg_len - sizeof(struct linux_cmsghdr)); + break; + } + + break; + default: + memcpy(linux_optval, freebsd_optval, linux_cmsg->cmsg_len - sizeof(struct linux_cmsghdr)); + break; + } + + linux_cmsg = LINUX_CMSG_NXTHDR(linux_msg, linux_cmsg); + freebsd_cmsg = CMSG_NXTHDR(freebsd_msg, freebsd_cmsg); + } + + return 0; +} + +static inline int +linux2freebsd_cmsg(const struct linux_msghdr *linux_msg, struct msghdr *freebsd_msg) +{ + struct cmsghdr *freebsd_cmsg = CMSG_FIRSTHDR(freebsd_msg); + struct linux_cmsghdr *linux_cmsg = LINUX_CMSG_FIRSTHDR(linux_msg); + + while (freebsd_cmsg && linux_cmsg) { + unsigned char *freebsd_optval = CMSG_DATA(freebsd_cmsg); + unsigned char *linux_optval = LINUX_CMSG_DATA(linux_cmsg); + + freebsd_cmsg->cmsg_type = linux_cmsg->cmsg_type; + freebsd_cmsg->cmsg_level = linux_cmsg->cmsg_level; + freebsd_cmsg->cmsg_len = CMSG_LEN(linux_cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct linux_cmsghdr))); + + switch (linux_cmsg->cmsg_level) { + case IPPROTO_IP: + switch (linux_cmsg->cmsg_type) { + case LINUX_IP_TOS: + freebsd_cmsg->cmsg_type = IP_TOS; + freebsd_cmsg->cmsg_len = CMSG_LEN(sizeof(char)); + + if (linux_cmsg->cmsg_len == LINUX_CMSG_LEN(sizeof(int))) { + *freebsd_optval = *(int *)linux_optval; + } else if (linux_cmsg->cmsg_len == LINUX_CMSG_LEN(sizeof(char))) { + *freebsd_optval = *linux_optval; + } + + break; + case LINUX_IP_TTL: + freebsd_cmsg->cmsg_type = IP_TTL; + freebsd_cmsg->cmsg_len = CMSG_LEN(sizeof(char)); + + *freebsd_optval = *(int *)linux_optval; + + break; + /*case XXXX: + break;*/ + default: + memcpy(freebsd_optval, linux_optval, linux_cmsg->cmsg_len - sizeof(struct linux_cmsghdr)); + break; + } + + break; + default: + memcpy(freebsd_optval, linux_optval, linux_cmsg->cmsg_len - sizeof(struct linux_cmsghdr)); + break; + } + + linux_cmsg = LINUX_CMSG_NXTHDR(linux_msg, linux_cmsg); + freebsd_cmsg = CMSG_NXTHDR(freebsd_msg, freebsd_cmsg); + } - bcopy(freebsd->sa_data, linux->sa_data, freebsd->sa_len - sizeof(linux->sa_family)); + return 0; +} + +/* + * While sendmsg, need convert msg_name and msg_control from Linux to FreeBSD. + * While recvmsg, need convert msg_name and msg_control from FreeBSD to Linux. + * Note: linux2freebsd_msghdr and freebsd2linux_msghdr must be called in sequence and in pairs. + */ +static int +freebsd2linux_msghdr(struct linux_msghdr *linux_msg, struct msghdr *freebsd_msg, int send_flag) +{ + if (linux_msg == NULL || freebsd_msg == NULL) { + return -1; + } + + if (linux_msg->msg_name && freebsd_msg->msg_name && !send_flag) { + linux_msg->msg_name = freebsd_msg->msg_name; + freebsd2linux_sockaddr(linux_msg->msg_name, freebsd_msg->msg_name); + linux_msg->msg_namelen = freebsd_msg->msg_namelen; + } + + linux_msg->msg_iov = freebsd_msg->msg_iov; + linux_msg->msg_iovlen = freebsd_msg->msg_iovlen; + /* Restore the old iov pointer, compatible with the Linux interface */ + memcpy(linux_msg->msg_iov, msg_iov_tmp, msg_iovlen_tmp * sizeof(struct iovec)); + + if(freebsd_msg->msg_control && linux_msg->msg_control && !send_flag) { + freebsd2linux_cmsghdr(linux_msg, freebsd_msg); + linux_msg->msg_controllen = freebsd_msg->msg_controllen; + } + + linux_msg->msg_flags = freebsd_msg->msg_flags; + + return 0; +} + +static int +linux2freebsd_msghdr(const struct linux_msghdr *linux_msg, struct msghdr *freebsd_msg, int send_flag) +{ + int ret = 0; + + if (linux_msg == NULL || freebsd_msg == NULL) { + return -1;; + } + + if (linux_msg->msg_name && freebsd_msg->msg_name && send_flag) { + linux2freebsd_sockaddr(linux_msg->msg_name, linux_msg->msg_namelen, freebsd_msg->msg_name); + } else { + freebsd_msg->msg_name = linux_msg->msg_name; + } + freebsd_msg->msg_namelen = linux_msg->msg_namelen; + + /* Save the old iov pointer, compatible with the Linux interface */ + msg_iovlen_tmp = linux_msg->msg_iovlen; + if (msg_iovlen_tmp > UIO_MAXIOV) { + return -1; // EMSGSIZE; + } + memcpy(msg_iov_tmp, linux_msg->msg_iov, msg_iovlen_tmp * sizeof(struct iovec)); + freebsd_msg->msg_iov = linux_msg->msg_iov; + freebsd_msg->msg_iovlen = linux_msg->msg_iovlen; + + freebsd_msg->msg_controllen = linux_msg->msg_controllen; + if (linux_msg->msg_control && send_flag) { + ret = linux2freebsd_cmsg(linux_msg, freebsd_msg); + if(ret < 0) { + return ret; + } + } else { + freebsd_msg->msg_control = linux_msg->msg_control; + } + + freebsd_msg->msg_flags = linux_msg->msg_flags; + + return 0; } int @@ -604,7 +869,7 @@ ff_close(int fd) { int rc; - if ((rc = kern_close(curthread, fd))) + if ((rc = kern_close(curthread, fd))) goto kern_fail; return (rc); @@ -619,7 +884,7 @@ ff_read(int fd, void *buf, size_t nbytes) struct uio auio; struct iovec aiov; int rc; - + if (nbytes > INT_MAX) { rc = EINVAL; goto kern_fail; @@ -686,7 +951,7 @@ ff_write(int fd, const void *buf, size_t nbytes) if ((rc = kern_writev(curthread, fd, &auio))) goto kern_fail; rc = curthread->td_retval[0]; - + return (rc); kern_fail: ff_os_errno(rc); @@ -709,7 +974,7 @@ ff_writev(int fd, const struct iovec *iov, int iovcnt) if ((rc = kern_writev(curthread, fd, &auio))) goto kern_fail; rc = curthread->td_retval[0]; - + return (rc); kern_fail: ff_os_errno(rc); @@ -760,25 +1025,39 @@ ff_sendto(int s, const void *buf, size_t len, int flags, ssize_t ff_sendmsg(int s, const struct msghdr *msg, int flags) { - int rc; + int rc, ret; struct sockaddr_storage freebsd_sa; - void *linux_sa = msg->msg_name; - - if (linux_sa != NULL) { - linux2freebsd_sockaddr(linux_sa, - sizeof(struct linux_sockaddr), (struct sockaddr *)&freebsd_sa); - __DECONST(struct msghdr *, msg)->msg_name = &freebsd_sa; + struct msghdr freebsd_msg; + struct cmsghdr *freebsd_cmsg = NULL; + + freebsd_msg.msg_name = &freebsd_sa; + if ((__DECONST(struct linux_msghdr *, msg))->msg_control) { + freebsd_cmsg = malloc((__DECONST(struct linux_msghdr *, msg))->msg_controllen, NULL, 0); + if (freebsd_cmsg == NULL) { + rc = ENOMEM; + goto kern_fail; + } } + freebsd_msg.msg_control = freebsd_cmsg; - rc = sendit(curthread, s, __DECONST(struct msghdr *, msg), flags); - - __DECONST(struct msghdr *, msg)->msg_name = linux_sa; + ret = linux2freebsd_msghdr((const struct linux_msghdr *)msg, &freebsd_msg, 1); + if (ret < 0) { + rc = EINVAL; + goto kern_fail; + } + rc = sendit(curthread, s, &freebsd_msg, flags); if (rc) goto kern_fail; rc = curthread->td_retval[0]; + freebsd2linux_msghdr(__DECONST(struct linux_msghdr *, msg), &freebsd_msg, 1); + + if (freebsd_cmsg) { + free(freebsd_cmsg, NULL); + } + return (rc); kern_fail: ff_os_errno(rc); @@ -819,7 +1098,7 @@ ff_recvfrom(int s, void *buf, size_t len, int flags, if (fromlen != NULL) *fromlen = msg.msg_namelen; - if (from) + if (from && msg.msg_namelen != 0) freebsd2linux_sockaddr(from, (struct sockaddr *)&bsdaddr); return (rc); @@ -828,27 +1107,25 @@ ff_recvfrom(int s, void *buf, size_t len, int flags, return (-1); } -/* - * It is considered here that the upper 4 bytes of - * msg->iovlen and msg->msg_controllen in linux_msghdr are 0. - */ ssize_t ff_recvmsg(int s, struct msghdr *msg, int flags) { - int rc; - struct linux_msghdr *linux_msg = (struct linux_msghdr *)msg; + int rc, ret; + struct msghdr freebsd_msg; - msg->msg_flags = flags; + ret = linux2freebsd_msghdr((struct linux_msghdr *)msg, &freebsd_msg, 0); + if (ret < 0) { + rc = EINVAL; + goto kern_fail; + } + freebsd_msg.msg_flags = flags; - if ((rc = kern_recvit(curthread, s, msg, UIO_SYSSPACE, NULL))) { - msg->msg_flags = 0; + if ((rc = kern_recvit(curthread, s, &freebsd_msg, UIO_SYSSPACE, NULL))) { goto kern_fail; } rc = curthread->td_retval[0]; - freebsd2linux_sockaddr(linux_msg->msg_name, msg->msg_name); - linux_msg->msg_flags = msg->msg_flags; - msg->msg_flags = 0; + freebsd2linux_msghdr((struct linux_msghdr *)msg, &freebsd_msg, 0); return (rc); kern_fail: @@ -866,7 +1143,7 @@ ff_fcntl(int fd, int cmd, ...) va_start(ap, cmd); argp = va_arg(ap, uintptr_t); - va_end(ap); + va_end(ap); if ((rc = kern_fcntl(curthread, fd, cmd, argp))) goto kern_fail; @@ -897,11 +1174,11 @@ ff_accept(int s, struct linux_sockaddr * addr, if (addrlen) *addrlen = pf->sa_len; - + if(pf != NULL) free(pf, M_SONAME); return (rc); - + kern_fail: if(pf != NULL) free(pf, M_SONAME); @@ -929,7 +1206,7 @@ ff_listen(int s, int backlog) int ff_bind(int s, const struct linux_sockaddr *addr, socklen_t addrlen) { - int rc; + int rc; struct sockaddr_storage bsdaddr; linux2freebsd_sockaddr(addr, addrlen, (struct sockaddr *)&bsdaddr); @@ -974,7 +1251,7 @@ ff_getpeername(int s, struct linux_sockaddr * name, if(pf != NULL) free(pf, M_SONAME); return (rc); - + kern_fail: if(pf != NULL) free(pf, M_SONAME); @@ -1006,7 +1283,7 @@ ff_getsockname(int s, struct linux_sockaddr *name, return (-1); } -int +int ff_shutdown(int s, int how) { int rc; @@ -1031,7 +1308,7 @@ ff_sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, int rc; size_t retval; - rc = userland_sysctl(curthread, __DECONST(int *, name), namelen, oldp, oldlenp, + rc = userland_sysctl(curthread, __DECONST(int *, name), namelen, oldp, oldlenp, 1, __DECONST(void *, newp), newlen, &retval, 0); if (rc) goto kern_fail; @@ -1143,8 +1420,8 @@ kevent_copyin(void *arg, struct kevent *kevp, int count) } int -ff_kevent_do_each(int kq, const struct kevent *changelist, int nchanges, - void *eventlist, int nevents, const struct timespec *timeout, +ff_kevent_do_each(int kq, const struct kevent *changelist, int nchanges, + void *eventlist, int nevents, const struct timespec *timeout, void (*do_each)(void **, struct kevent *)) { int rc; @@ -1168,7 +1445,7 @@ ff_kevent_do_each(int kq, const struct kevent *changelist, int nchanges, kevent_copyin }; - if ((rc = kern_kevent(curthread, kq, nchanges, nevents, &k_ops, + if ((rc = kern_kevent(curthread, kq, nchanges, nevents, &k_ops, &ts))) goto kern_fail; @@ -1180,14 +1457,18 @@ ff_kevent_do_each(int kq, const struct kevent *changelist, int nchanges, } int -ff_kevent(int kq, const struct kevent *changelist, int nchanges, +ff_kevent(int kq, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout) { return ff_kevent_do_each(kq, changelist, nchanges, eventlist, nevents, timeout, NULL); } int +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 31) +ff_gettimeofday(struct timeval *tv, void *tz) +#else ff_gettimeofday(struct timeval *tv, struct timezone *tz) +#endif { long nsec; ff_get_current_time(&(tv->tv_sec), &nsec); diff --git a/lib/ff_veth.c b/lib/ff_veth.c index 57276ae46..c03e87b99 100644 --- a/lib/ff_veth.c +++ b/lib/ff_veth.c @@ -48,10 +48,14 @@ #include #include #include +#include #include #include #include +#ifdef FF_IPFW +#include +#endif #include @@ -69,10 +73,17 @@ struct ff_veth_softc { in_addr_t broadcast; in_addr_t gateway; + uint8_t nb_vip; + in_addr_t vip[VIP_MAX_NUM]; + #ifdef INET6 struct in6_addr ip6; struct in6_addr gateway6; uint8_t prefix_length; + + uint8_t nb_vip6; + uint8_t vip_prefix_length; + struct in6_addr vip6[VIP_MAX_NUM]; #endif /* INET6 */ struct ff_dpdk_if_context *host_ctx; @@ -81,12 +92,26 @@ struct ff_veth_softc { static int ff_veth_config(struct ff_veth_softc *sc, struct ff_port_cfg *cfg) { + int i, j; + memcpy(sc->mac, cfg->mac, ETHER_ADDR_LEN); inet_pton(AF_INET, cfg->addr, &sc->ip); inet_pton(AF_INET, cfg->netmask, &sc->netmask); inet_pton(AF_INET, cfg->broadcast, &sc->broadcast); inet_pton(AF_INET, cfg->gateway, &sc->gateway); + if (cfg->nb_vip) { + for (i = 0, j = 0; i < cfg->nb_vip; ++i) { + if (inet_pton(AF_INET, cfg->vip_addr_array[i], &sc->vip[j])) { + j++; + } else { + printf("ff_veth_config inet_pton vip %s failed.\n", cfg->vip_addr_array[i]); + } + } + + sc->nb_vip = j; + } + #ifdef INET6 if (cfg->addr6_str) { inet_pton(AF_INET6_LINUX, cfg->addr6_str, &sc->ip6); @@ -103,11 +128,81 @@ ff_veth_config(struct ff_veth_softc *sc, struct ff_port_cfg *cfg) } else { printf("%s: No addr6 config found.\n", sc->host_ifname); } + + if (cfg->nb_vip6) { + for (i = 0, j = 0; i < cfg->nb_vip6; ++i) { + if (inet_pton(AF_INET6_LINUX, cfg->vip_addr6_array[i], &sc->vip6[j])) { + j++; + } else { + printf("ff_veth_config inet_pton vip6 %s failed.\n", cfg->vip_addr6_array[i]); + } + } + + sc->nb_vip6 = j; + sc->vip_prefix_length = cfg->vip_prefix_len == 0 ? 64 : cfg->vip_prefix_len; + } #endif /* INET6 */ return 0; } +static int +ff_veth_vlan_config(struct ff_veth_softc *sc, struct ff_vlan_cfg *cfg) +{ + int i, j; + + inet_pton(AF_INET, cfg->addr, &sc->ip); + inet_pton(AF_INET, cfg->netmask, &sc->netmask); + inet_pton(AF_INET, cfg->broadcast, &sc->broadcast); + inet_pton(AF_INET, cfg->gateway, &sc->gateway); + + if (cfg->nb_vip) { + for (i = 0, j = 0; i < cfg->nb_vip; ++i) { + if (inet_pton(AF_INET, cfg->vip_addr_array[i], &sc->vip[j])) { + j++; + } else { + printf("ff_veth_vlan_config inet_pton vip %s failed.\n", cfg->vip_addr_array[i]); + } + } + + sc->nb_vip = j; + } + +#ifdef INET6 + if (cfg->addr6_str) { + inet_pton(AF_INET6_LINUX, cfg->addr6_str, &sc->ip6); + printf("%s: Addr6: %s\n", sc->host_ifname, cfg->addr6_str); + + if (cfg->gateway6_str) { + inet_pton(AF_INET6_LINUX, cfg->gateway6_str, &sc->gateway6); + printf("%s: Gateway6: %s\n", sc->host_ifname, cfg->gateway6_str); + } else { + printf("%s: No gateway6 config found.\n", sc->host_ifname); + } + + sc->prefix_length = cfg->prefix_len == 0 ? 64 : cfg->prefix_len; + } else { + printf("%s: No addr6 config found.\n", sc->host_ifname); + } + + if (cfg->nb_vip6) { + for (i = 0, j = 0; i < cfg->nb_vip6; ++i) { + if (inet_pton(AF_INET6_LINUX, cfg->vip_addr6_array[i], &sc->vip6[j])) { + j++; + } else { + printf("ff_veth_vlan_config inet_pton vip6 %s failed.\n", cfg->vip_addr6_array[i]); + } + } + + sc->nb_vip6 = j; + sc->vip_prefix_length = cfg->vip_prefix_len == 0 ? 64 : cfg->vip_prefix_len; + } +#endif /* INET6 */ + + return 0; +} + + static void ff_veth_init(void *arg) { @@ -116,6 +211,7 @@ ff_veth_init(void *arg) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + ifp->if_flags |= IFF_UP; } static void @@ -130,6 +226,7 @@ ff_veth_stop(struct ff_veth_softc *sc) struct ifnet *ifp = sc->ifp; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING|IFF_DRV_OACTIVE); + ifp->if_flags &= ~IFF_UP; } static int @@ -299,7 +396,7 @@ ff_mbuf_get(void *p, void *m, void *data, uint16_t len) struct mbuf *mb = m_get(M_NOWAIT, MT_DATA); if (mb == NULL) { - return NULL; + return NULL; } m_extadd(mb, data, len, ff_mbuf_ext_free, m, NULL, 0, EXT_DISPOSABLE); @@ -340,11 +437,16 @@ ff_veth_qflush(struct ifnet *ifp) } static int -ff_veth_setaddr(struct ff_veth_softc *sc) +ff_veth_setaddr(struct ff_veth_softc *sc, const char *if_name) { struct in_aliasreq req; bzero(&req, sizeof req); - strcpy(req.ifra_name, sc->ifp->if_dname); + + if (if_name) { + strcpy(req.ifra_name, if_name); + } else { + strcpy(req.ifra_name, sc->ifp->if_dname); + } struct sockaddr_in sa; bzero(&sa, sizeof(sa)); @@ -363,13 +465,13 @@ ff_veth_setaddr(struct ff_veth_softc *sc) socreate(AF_INET, &so, SOCK_DGRAM, 0, curthread->td_ucred, curthread); int ret = ifioctl(so, SIOCAIFADDR, (caddr_t)&req, curthread); - sofree(so); + soclose(so); return ret; } static int -ff_veth_set_gateway(struct ff_veth_softc *sc) +ff_veth_set_gateway(struct ff_veth_softc *sc, uint32_t fib_num) { struct sockaddr_in gw; bzero(&gw, sizeof(gw)); @@ -390,16 +492,223 @@ ff_veth_set_gateway(struct ff_veth_softc *sc) nm.sin_addr.s_addr = 0; return rtrequest_fib(RTM_ADD, (struct sockaddr *)&dst, (struct sockaddr *)&gw, - (struct sockaddr *)&nm, RTF_GATEWAY, NULL, RT_DEFAULT_FIB); + (struct sockaddr *)&nm, RTF_GATEWAY, NULL, fib_num); } +static int +ff_veth_setvaddr(struct ff_veth_softc *sc, struct ff_port_cfg *cfg, const char *if_name) +{ + struct in_aliasreq req; + bzero(&req, sizeof req); + + if (if_name) { + strlcpy(req.ifra_name, if_name, IFNAMSIZ); + } else if (cfg->vip_ifname) { + strlcpy(req.ifra_name, cfg->vip_ifname, IFNAMSIZ); + } else { + strlcpy(req.ifra_name, sc->ifp->if_dname, IFNAMSIZ); + } + + struct sockaddr_in sa; + bzero(&sa, sizeof(sa)); + sa.sin_len = sizeof(sa); + sa.sin_family = AF_INET; + + int i, ret; + struct socket *so = NULL; + socreate(AF_INET, &so, SOCK_DGRAM, 0, curthread->td_ucred, curthread); + + for (i = 0; i < sc->nb_vip; ++i) { + sa.sin_addr.s_addr = sc->vip[i]; + bcopy(&sa, &req.ifra_addr, sizeof(sa)); + + // Only support '255.255.255.255' netmask now + sa.sin_addr.s_addr = 0xFFFFFFFF; + bcopy(&sa, &req.ifra_mask, sizeof(sa)); + + // Only support 'x.x.x.x' broadaddr now + sa.sin_addr.s_addr = sc->vip[i] /*| 0xFF000000*/; + bcopy(&sa, &req.ifra_broadaddr, sizeof(sa)); + + ret = ifioctl(so, SIOCAIFADDR, (caddr_t)&req, curthread); + if (ret < 0) { + printf("ff_veth_setvaddr ifioctl SIOCAIFADDR error\n"); + goto done; + } + } + +done: + soclose(so); + + return ret; +} + +#ifdef FF_IPFW +/* + * Only supports the simplest policy routing settings, like: + * `ff_ipfw -P 0 add 100 setfib 0 ip from 125.94.59.0/24 to any out` + * `from 125.94.59.0/24` need set addr is '125.94.59.0', netmask is '255.255.255.0' + * + * More policy routing settings should use tool `ff_ipfw`. + */ +static int +ff_ipfw_add_simple_v4(struct ff_port_cfg *port_cfg, struct ff_vlan_cfg *vlan_cfg, uint32_t fib_num) +{ + struct ff_ipfw_pr_cfg *pr_cfg; + uint32_t nb_pr; + int ret = -1, fd, i; + int level = IPPROTO_IP, optname; + uint32_t rulebuf[1024]; + socklen_t sz; + ip_fw3_opheader *op3; + ipfw_obj_ctlv *ctlv; + struct ip_fw_rule *rule; + ipfw_insn *cmd; + ipfw_insn *action; + ipfw_insn_ip *cmd_ip; + int rule_len, ctlv_count = 1, cmd_count = 5, act_ofs = 4, cmd_ip_count = 3, action_count = 1; + uint32_t rule_num; + + if (port_cfg) { + pr_cfg = port_cfg->pr_cfg; + nb_pr = port_cfg->nb_pr; + } else if (vlan_cfg) { + pr_cfg = vlan_cfg->pr_cfg; + nb_pr = vlan_cfg->nb_pr; + } else { + return -1; + } + + fd = ff_socket(AF_INET, SOCK_RAW, IPPROTO_RAW); + if (fd < 0) { + printf("ff_set_ipfw ff_socket error\n"); + goto done; + } + + memset(rulebuf, 0, sizeof(rulebuf)); + /* Because `struct ip_fw_rule` has 1 cmd(`ipfw_insn`), so should (cmd_count - 1), and then routeup2 8 bytes */ + rule_len = sizeof(struct ip_fw_rule) + (cmd_count - 1) * sizeof(ipfw_insn); + rule_len = roundup2(rule_len, sizeof(uint64_t)); + sz = sizeof(ip_fw3_opheader) + sizeof(ipfw_obj_ctlv) + rule_len; + + op3 = (ip_fw3_opheader *)rulebuf; + op3->opcode = IP_FW_XADD; + + /* + * {head = {type = 3, flags = 0, length = 56}, count = 1, objsize = 0, version = 0 '\000', flags = 0 '\000'} + * type:IPFW_TLV_RULE_LIST(3), length:ctlv header length + rule total length + */ + ctlv = (ipfw_obj_ctlv *)(op3 + 1); + ctlv->head.type = IPFW_TLV_RULE_LIST; + ctlv->head.length = sizeof(ipfw_obj_ctlv) + rule_len; + ctlv->count = ctlv_count; + //rule->rulenum = rule_num; + rule = (struct ip_fw_rule *)(ctlv + 1); + + + /* Need rule num(100/200/300/400), ip/mask,fib num(0/1/2/3/4) */ + /* $124 = {act_ofs = 4, cmd_len = 5, spare = 0, set = 0 '\000', flags = 0 '\000', rulenum = 200, id = 0, cmd = {{opcode = 2 '\002', len = 3 '\003', arg1 = 0}}} + * act_ofs is 4 means jump four cmd, it's point to the first action's index, + * cmd_len means total nums of cmd and action, per 4 bytes(sizeof(ipfw_insn)). + */ + rule->act_ofs = act_ofs; + rule->cmd_len = cmd_count; + + /* + * cmd: 3 + 1 + * src IP: + cmd[0] {opcode = 2 '\002', len = 3 '\003', arg1 = 0} + opcode is 2(O_IP_SRC_MASK), + len = 3 means three 4 bytes, + + [0] means cmd itself. + (gdb) p *(ipfw_insn_ip *)cmd + $61 = {o = {opcode = 2 '\002', len = 3 '\003', arg1 = 0}, addr = {s_addr = 373155}, mask = {s_addr = 16777215}} + + [1] means `IP & mask`'s' value. + [2] means netmask, sucn as /24 is 0xffffff00 + (gdb) x/12x cmd + 0xe74860 : 0x02 0x03 0x00 0x00 0xa3 0xb1 0x05 0x00 + 0xe74868 : 0xff 0xff 0xff 0x00 + * + * out: + cmd[3] + i = 40 // TOK_OUT + cmd->len ^= F_NOT; + cmd->len = 128 + {opcode = 15 '\017', len = 129 '\201', arg1 = 0} + opcode is 15(O_IN none), + len=129 & 3f = 1, just jump one 4 bytes. + Although len is 129, but just have one header, no actual data. + */ + cmd_ip = (ipfw_insn_ip *)((ipfw_insn *)(rule + 1) - 1); + cmd_ip->o.opcode = O_IP_SRC_MASK; + cmd_ip->o.len = cmd_ip_count; + //inet_pton(AF_INET, addr, (void *)&(cmd_ip->addr)); + //inet_pton(AF_INET, netmask, (void *)&(cmd_ip->mask)); + + cmd = (ipfw_insn *)(cmd_ip + 1); + cmd->opcode = O_IN; + cmd->len ^= F_NOT; + cmd->len = ((cmd->len | 0) & (F_NOT | F_OR)) | 1; // flags = 0 + + /* + * action:1 + * setfib 0: // action[0] + i = TOK_SETFIB // 120 + action->len = 1; + action->opcode = O_SETFIB; // 82 + action->arg1 = strtoul(*av, NULL, 10); // fib num: 0、1、2、3 + action->arg1 |= 0x8000; // 32768 + fib num + + (gdb) p *action + $34 = {opcode = 82 'R', len = 1 '\001', arg1 = 32769} + + (gdb) x/4b actbuf + 0xe74460 : 0x52 0x01 0x01 0x80 + */ + action = (ipfw_insn *)(cmd + 1); + action->opcode = O_SETFIB; + action->len = action_count; + //action->arg1 = fib_num; + //action->arg1 |= 0x8000; + + for (i = 0; i < nb_pr; i++) { + rule_num = (fib_num + 1) * 10; + rule->rulenum = rule_num; + inet_pton(AF_INET, pr_cfg[i].addr, (void *)&(cmd_ip->addr)); + inet_pton(AF_INET, pr_cfg[i].netmask, (void *)&(cmd_ip->mask)); + action->arg1 = fib_num; + action->arg1 |= 0x8000; + + ret = ff_getsockopt(fd, IPPROTO_IP, IP_FW3, (void *)op3, (socklen_t *)&sz); + if (ret < 0) { + printf("ff_set_ipfw kern_getsockopt error\n"); + goto done; + } + } + +done: + if (fd > 0) { + ff_close(fd); + } + + return ret; +} +#endif + #ifdef INET6 static int -ff_veth_setaddr6(struct ff_veth_softc *sc) +ff_veth_setaddr6(struct ff_veth_softc *sc, const char *if_name) { struct in6_aliasreq ifr6; bzero(&ifr6, sizeof(ifr6)); - strcpy(ifr6.ifra_name, sc->ifp->if_dname); + + if (if_name) { + strcpy(ifr6.ifra_name, if_name); + } else { + strcpy(ifr6.ifra_name, sc->ifp->if_dname); + } ifr6.ifra_addr.sin6_len = sizeof ifr6.ifra_addr; ifr6.ifra_addr.sin6_family = AF_INET6; @@ -410,22 +719,25 @@ ff_veth_setaddr6(struct ff_veth_softc *sc) uint8_t mask_size_mod = sc->prefix_length % 8; if (mask_size_mod) { - ifr6.ifra_prefixmask.sin6_addr.__u6_addr.__u6_addr8[sc->prefix_length / 8] = ((1 << mask_size_mod) - 1) << (8 - mask_size_mod); + ifr6.ifra_prefixmask.sin6_addr.__u6_addr.__u6_addr8[sc->prefix_length / 8] = \ + ((1 << mask_size_mod) - 1) << (8 - mask_size_mod); } ifr6.ifra_lifetime.ia6t_pltime = ifr6.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + ifr6.ifra_flags |= IN6_IFF_AUTOCONF; + struct socket *so = NULL; socreate(AF_INET6, &so, SOCK_DGRAM, 0, curthread->td_ucred, curthread); int ret = ifioctl(so, SIOCAIFADDR_IN6, (caddr_t)&ifr6, curthread); - sofree(so); + soclose(so); return ret; } static int -ff_veth_set_gateway6(struct ff_veth_softc *sc) +ff_veth_set_gateway6(struct ff_veth_softc *sc, uint32_t fib_num) { struct sockaddr_in6 gw, dst, nm; @@ -440,7 +752,57 @@ ff_veth_set_gateway6(struct ff_veth_softc *sc) //dst.sin6_addr = nm.sin6_addr = 0; return rtrequest_fib(RTM_ADD, (struct sockaddr *)&dst, (struct sockaddr *)&gw, - (struct sockaddr *)&nm, RTF_GATEWAY, NULL, RT_DEFAULT_FIB); + (struct sockaddr *)&nm, RTF_GATEWAY, NULL, fib_num); +} + +static int +ff_veth_setvaddr6(struct ff_veth_softc *sc, struct ff_port_cfg *cfg, const char *if_name) +{ + struct in6_aliasreq ifr6; + bzero(&ifr6, sizeof(ifr6)); + + if (if_name) { + strlcpy(ifr6.ifra_name, if_name, IFNAMSIZ); + } else if (cfg->vip_ifname) { + strlcpy(ifr6.ifra_name, cfg->vip_ifname, IFNAMSIZ); + } else { + strlcpy(ifr6.ifra_name, sc->ifp->if_dname, IFNAMSIZ); + } + + ifr6.ifra_addr.sin6_len = sizeof ifr6.ifra_addr; + ifr6.ifra_addr.sin6_family = AF_INET6; + + ifr6.ifra_prefixmask.sin6_len = sizeof ifr6.ifra_prefixmask; + memset(&ifr6.ifra_prefixmask.sin6_addr, 0xff, sc->prefix_length / 8); + uint8_t mask_size_mod = sc->prefix_length % 8; + if (mask_size_mod) + { + ifr6.ifra_prefixmask.sin6_addr.__u6_addr.__u6_addr8[sc->prefix_length / 8] = \ + ((1 << mask_size_mod) - 1) << (8 - mask_size_mod); + } + + ifr6.ifra_lifetime.ia6t_pltime = ifr6.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + + ifr6.ifra_flags |= IN6_IFF_AUTOCONF; + + struct socket *so = NULL; + socreate(AF_INET6, &so, SOCK_DGRAM, 0, curthread->td_ucred, curthread); + + int i, ret; + for (i = 0; i < sc->nb_vip6; ++i) { + ifr6.ifra_addr.sin6_addr = sc->vip6[i]; + + ret = ifioctl(so, SIOCAIFADDR_IN6, (caddr_t)&ifr6, curthread); + if (ret < 0) { + printf("ff_veth_setvaddr6 ifioctl SIOCAIFADDR error\n"); + goto done; + } + } + +done: + soclose(so); + + return ret; } #endif /* INET6 */ @@ -448,6 +810,8 @@ static int ff_veth_setup_interface(struct ff_veth_softc *sc, struct ff_port_cfg *cfg) { struct ifnet *ifp; + int ret; + uint32_t fib_num = RT_DEFAULT_FIB; ifp = sc->ifp = if_alloc(IFT_ETHER); @@ -483,34 +847,135 @@ ff_veth_setup_interface(struct ff_veth_softc *sc, struct ff_port_cfg *cfg) if (sc->host_ctx == NULL) { printf("%s: Failed to register dpdk interface\n", sc->host_ifname); return -1; + } else { + printf("%s: Successed to register dpdk interface\n", sc->host_ifname); } - //set ip - int ret = ff_veth_setaddr(sc); - if (ret != 0) { - printf("ff_veth_setaddr failed\n"); - } - ret = ff_veth_set_gateway(sc); - if (ret != 0) { - printf("ff_veth_set_gateway failed\n"); - } + /* if vlan_flag is true, all port's addrs/vips will not to set, just create the iface */ + if (cfg->nb_vlan == 0) { + // Set IP + ret = ff_veth_setaddr(sc, NULL); + if (ret != 0) { + printf("%s: ff_veth_setaddr failed\n", sc->host_ifname); + } -#ifdef INET6 - // Set IPv6 - if (cfg->addr6_str) { - ret = ff_veth_setaddr6(sc); + fib_num = cfg->port_id; + ret = ff_veth_set_gateway(sc, fib_num); if (ret != 0) { - printf("ff_veth_setaddr6 failed\n"); + printf("%s: ff_veth_set_gateway failed\n", sc->host_ifname); } - if (cfg->gateway6_str) { - ret = ff_veth_set_gateway6(sc); + if (sc->nb_vip) { + ret = ff_veth_setvaddr(sc, cfg, NULL); + } + +#ifdef FF_IPFW + if (cfg->nb_pr) { + ff_ipfw_add_simple_v4(cfg, NULL, fib_num); + } +#endif + +#ifdef INET6 + // Set IPv6 + if (cfg->addr6_str) { + ret = ff_veth_setaddr6(sc, NULL); if (ret != 0) { - printf("ff_veth_set_gateway6 failed\n"); + printf("%s: ff_veth_setaddr6 failed\n", sc->host_ifname); + } + + if (cfg->gateway6_str) { + /* + * IPv6 not support set multi route fib now, just use RT_DEFAULT_FIB. + * And you can set multi fib use tool 'ff_route' a + */ + fib_num = RT_DEFAULT_FIB; + ret = ff_veth_set_gateway6(sc, fib_num); + if (ret != 0) { + printf("%s: ff_veth_set_gateway6 failed\n", sc->host_ifname); + } } } - } + + if (sc->nb_vip6) { + ret = ff_veth_setvaddr6(sc, cfg, NULL); + } #endif /* INET6 */ + }else { + char vlan_if_name[IFNAMSIZ]; + int idx; + struct ff_vlan_cfg *vlan_cfg; + struct ff_veth_softc vlan_sc; + + ff_veth_init(sc); + + for (idx = 0; idx < cfg->nb_vlan; idx++) { + /* create vlan interface */ + vlan_cfg = cfg->vlan_cfgs[idx]; + snprintf(vlan_if_name, IFNAMSIZ, "%s.%d", sc->host_ifname, vlan_cfg->vlan_id); + ret = if_clone_create(vlan_if_name, IFNAMSIZ, NULL); + if (0 != ret) { + printf("%s: Failed to if_clone_create vlan interface\n", vlan_if_name); + return -1; + } else { + printf("%s: Successed to if_clone_create vlan interface\n", vlan_if_name); + } + + // Set vlan IP + memset(&vlan_sc, 0, sizeof(vlan_sc)); + ret = ff_veth_vlan_config(&vlan_sc, vlan_cfg); + if (0 != ret) { + printf("%s: Failed to ff_veth_vlan_config\n", vlan_if_name); + return -1; + } + + ret = ff_veth_setaddr(&vlan_sc, vlan_if_name); + if (ret != 0) { + printf("%s: ff_veth_setaddr failed\n", vlan_if_name); + } + + fib_num = vlan_cfg->vlan_idx; + ret = ff_veth_set_gateway(&vlan_sc, fib_num); + if (ret != 0) { + printf("%s: ff_veth_set_gateway of fib %u failed\n", vlan_if_name, fib_num); + } + + if (vlan_sc.nb_vip) { + ret = ff_veth_setvaddr(&vlan_sc, cfg, vlan_if_name); + } + +#ifdef FF_IPFW + if (vlan_cfg->nb_pr) { + ff_ipfw_add_simple_v4(NULL, vlan_cfg, fib_num); + } +#endif + +#ifdef INET6 + // Set vlan IPv6 + if (vlan_cfg->addr6_str) { + ret = ff_veth_setaddr6(&vlan_sc, vlan_if_name); + if (ret != 0) { + printf("%s: ff_veth_setaddr6 failed\n", vlan_if_name); + } + + if (vlan_cfg->gateway6_str) { + /* + * IPv6 not support set multi route fib now, just use RT_DEFAULT_FIB. + * And you can set multi fib use tool 'ff_route' a + */ + fib_num = RT_DEFAULT_FIB; + ret = ff_veth_set_gateway6(&vlan_sc, fib_num); + if (ret != 0) { + printf("%s: ff_veth_set_gateway6 of fib %u failed\n", vlan_if_name, fib_num); + } + } + } + + if (vlan_sc.nb_vip6) { + ret = ff_veth_setvaddr6(&vlan_sc, cfg, vlan_if_name); + } +#endif /* INET6 */ + } + } return (0); } @@ -528,7 +993,11 @@ ff_veth_attach(struct ff_port_cfg *cfg) } memset(sc, 0, sizeof(struct ff_veth_softc)); - snprintf(sc->host_ifname, sizeof(sc->host_ifname), ff_IF_NAME, cfg->port_id); + if(cfg->ifname){ + snprintf(sc->host_ifname, sizeof(sc->host_ifname), "%s", cfg->ifname); + } else { + snprintf(sc->host_ifname, sizeof(sc->host_ifname), ff_IF_NAME, cfg->port_id); + } error = ff_veth_config(sc, cfg); if (0 != error) { @@ -573,7 +1042,7 @@ ff_veth_softc_to_hostc(void *softc) /******************** * get next mbuf's addr, current mbuf's data and datalen. -* +* ********************/ int ff_next_mbuf(void **mbuf_bsd, void **data, unsigned *len) { @@ -605,7 +1074,7 @@ void* ff_rte_frm_extcl(void* mbuf) bsd_mbuf->m_ext.ext_type == EXT_DISPOSABLE && bsd_mbuf->m_ext.ext_free == ff_mbuf_ext_free ) { return bsd_mbuf->m_ext.ext_arg1; } - else + else return NULL; } diff --git a/tools/README.md b/tools/README.md index 1019e7a5a..35147bd8f 100644 --- a/tools/README.md +++ b/tools/README.md @@ -90,7 +90,7 @@ Examples: ./sbin/route -p 0 flush - FreeBSD uses `netstat -rn ` to list the route table which we havn't ported, + FreeBSD uses `netstat -rnW ` to list the route table which we havn't ported, you can execute the following command instead, `-d` means debug mode, `-v` means verbose. ./sbin/route -p 0 -d -v flush diff --git a/tools/compat/include/netgraph/ng_socket.h b/tools/compat/include/netgraph/ng_socket.h index b7e831018..a467fabd9 100644 --- a/tools/compat/include/netgraph/ng_socket.h +++ b/tools/compat/include/netgraph/ng_socket.h @@ -5,7 +5,7 @@ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; @@ -16,7 +16,7 @@ * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. - * + * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -62,7 +62,7 @@ enum { struct sockaddr_ng { unsigned char sg_len; /* total length */ sa_family_t sg_family; /* address family */ - char sg_data[14]; /* actually longer; address value */ + char sg_data[32]; /* see NG_NODESIZ in ng_message.h */ }; #endif /* _NETGRAPH_NG_SOCKET_H_ */ diff --git a/tools/libnetgraph/msg.c b/tools/libnetgraph/msg.c index 03b6d756c..1d86ba2d8 100644 --- a/tools/libnetgraph/msg.c +++ b/tools/libnetgraph/msg.c @@ -3,7 +3,7 @@ * * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Whistle Communications; @@ -14,7 +14,7 @@ * Communications, Inc. trademarks, including the mark "WHISTLE * COMMUNICATIONS" on advertising, endorsements, or otherwise except as * such appears in the above copyright notice or in the software. - * + * * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -217,7 +217,14 @@ NgDeliverMsg(int cs, const char *path, /* Prepare socket address */ sg->sg_family = AF_NETGRAPH; /* XXX handle overflow */ - strlcpy(sg->sg_data, path, NG_PATHSIZ); +#if __GNUC__ >= 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + strncpy(sg->sg_data, path, NG_PATHSIZ); +#if __GNUC__ >= 13 +#pragma GCC diagnostic pop +#endif sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD; /* Debugging */ diff --git a/tools/netstat/if.c b/tools/netstat/if.c index 901c956c3..5221d3b9e 100644 --- a/tools/netstat/if.c +++ b/tools/netstat/if.c @@ -393,7 +393,7 @@ intpr(void (*pfunc)(char *), int af) case AF_LINK: { struct sockaddr_dl *sdl; - char linknum[10]; + char linknum[sizeof("")]; sdl = (struct sockaddr_dl *)ifa->ifa_addr; sprintf(linknum, "", sdl->sdl_index); diff --git a/tools/ngctl/write.c b/tools/ngctl/write.c index 411421170..25cc99a2e 100644 --- a/tools/ngctl/write.c +++ b/tools/ngctl/write.c @@ -4,14 +4,14 @@ * * Copyright (c) 2002 Archie L. Cobbs * All rights reserved. - * + * * Subject to the following obligations and disclaimer of warranty, use and * redistribution of this software, in source or object code forms, with or * without modifications are expressly permitted by Archie L. Cobbs; * provided, however, that: * 1. Any and all reproductions of the source or object code must include the * copyright notice above and the following disclaimer of warranties - * + * * THIS SOFTWARE IS BEING PROVIDED BY ARCHIE L. COBBS AS IS", AND TO * THE MAXIMUM EXTENT PERMITTED BY LAW, ARCHIE L. COBBS MAKES NO * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, @@ -108,7 +108,14 @@ WriteCmd(int ac, char **av) /* Send data */ sag->sg_len = 3 + strlen(hook); sag->sg_family = AF_NETGRAPH; +#if __GNUC__ >= 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif strlcpy(sag->sg_data, hook, sizeof(sagbuf) - 2); +#if __GNUC__ >= 13 +#pragma GCC diagnostic pop +#endif if (sendto(dsock, buf, len, 0, (struct sockaddr *)sag, sag->sg_len) == -1) { warn("writing to hook \"%s\"", hook);