Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump up DPDK version to 22.11 #39

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bessctl/conf/port/vhost/launch_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def run_forward(vm_id, num_nics):
nics += ' 00:1{nic}.0'.format(nic=i)

scp(vm_id, os.path.join(bess_dir, 'bin/dpdk-devbind.py'), '')
scp(vm_id, os.path.join(bess_dir, 'deps/dpdk-20.11.3/build/app/dpdk-testpmd'), '')
scp(vm_id, os.path.join(bess_dir, 'deps/dpdk-22.11.4/build/app/dpdk-testpmd'), '')

# virtio-pci devices should not be bound to any driver
cmd = ssh_cmd(vm_id, 'sudo ./dpdk-devbind.py -u %s' % nics)
Expand Down
6 changes: 3 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def cmd(cmd, quiet=False, shell=False):
DEPS_DIR = '%s/deps' % BESS_DIR

DPDK_URL = 'https://fast.dpdk.org/rel'
DPDK_VER = 'dpdk-20.11.3'
gab-arrobo marked this conversation as resolved.
Show resolved Hide resolved
DPDK_VER = 'dpdk-22.11.4'
gab-arrobo marked this conversation as resolved.
Show resolved Hide resolved
DPDK_TARGET = 'x86_64-native-linuxapp-gcc'

kernel_release = cmd('uname -r', quiet=True).strip()
Expand Down Expand Up @@ -253,14 +253,14 @@ def download_dpdk(quiet=False):

def configure_dpdk():
print('Configuring DPDK...')
meson_opts = '--buildtype=debugoptimized'
meson_opts = '--buildtype=release -Denable_driver_sdk=true'

arch = os.getenv('CPU')
if arch:
print(' - Building DPDK with -march=%s' % arch)
meson_opts += ' -Dmachine=%s' % arch

cmd('meson %s %s %s' % (meson_opts, DPDK_BUILD, DPDK_DIR))
cmd('meson setup %s %s %s' % (meson_opts, DPDK_BUILD, DPDK_DIR))


def makeflags():
Expand Down
34 changes: 21 additions & 13 deletions core/drivers/pmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@

#include "pmd.h"

#include <bus_driver.h>
#include <bus_pci_driver.h>
#include <rte_bus.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h>
#include <rte_flow.h>
Expand All @@ -50,14 +53,15 @@ static const rte_eth_conf default_eth_conf(const rte_eth_dev_info &dev_info,
int nb_rxq) {
rte_eth_conf ret = {};

ret.link_speeds = ETH_LINK_SPEED_AUTONEG;
ret.rxmode.mq_mode = (nb_rxq > 1) ? ETH_MQ_RX_RSS : ETH_MQ_RX_NONE;
ret.link_speeds = RTE_ETH_LINK_SPEED_AUTONEG;
ret.rxmode.mq_mode = (nb_rxq > 1) ? RTE_ETH_MQ_RX_RSS : RTE_ETH_MQ_RX_NONE;
ret.rxmode.offloads = 0;

ret.rx_adv_conf.rss_conf = {
.rss_key = rss_key,
.rss_key_len = sizeof(rss_key),
.rss_hf = (ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP | ETH_RSS_SCTP) &
.rss_hf = (RTE_ETH_RSS_IP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_TCP |
RTE_ETH_RSS_SCTP) &
dev_info.flow_type_rss_offloads,
};

Expand Down Expand Up @@ -107,9 +111,12 @@ static CommandResponse find_dpdk_port_by_id(dpdk_port_t port_id,
if (port_id >= RTE_MAX_ETHPORTS) {
return CommandFailure(EINVAL, "Invalid port id %d", port_id);
gab-arrobo marked this conversation as resolved.
Show resolved Hide resolved
}
if (rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED) {
if (!rte_eth_dev_is_valid_port(port_id)) {
return CommandFailure(ENODEV, "Port id %d is not available", port_id);
}
if (rte_eth_dev_socket_id(port_id) < 0) {
return CommandFailure(ENODEV, "Port id %d is not attached", port_id);
}

*ret_port_id = port_id;
return CommandSuccess();
Expand Down Expand Up @@ -285,7 +292,7 @@ CommandResponse flow_create(dpdk_port_t port_id, const uint32_t &flow_profile) {
uint64_t rss_types;
// N3 traffic with and without PDU Session container
case profileN3:
rss_types = ETH_RSS_IPV4 | ETH_RSS_L3_SRC_ONLY;
rss_types = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY;
err = flow_create_one(port_id, flow_profile, NUM_ELEMENTS(N39_NSA),
rss_types, N39_NSA);
if (err.error().code() != 0) {
Expand All @@ -298,14 +305,14 @@ CommandResponse flow_create(dpdk_port_t port_id, const uint32_t &flow_profile) {

// N6 traffic
case profileN6:
rss_types = ETH_RSS_IPV4 | ETH_RSS_L3_DST_ONLY;
rss_types = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY;
err = flow_create_one(port_id, flow_profile, NUM_ELEMENTS(N6), rss_types,
N6);
break;

// N9 traffic with and without PDU Session container
case profileN9:
rss_types = ETH_RSS_IPV4 | ETH_RSS_L3_DST_ONLY;
rss_types = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY;
err = flow_create_one(port_id, flow_profile, NUM_ELEMENTS(N39_NSA),
rss_types, N39_NSA);
if (err.error().code() != 0) {
Expand Down Expand Up @@ -369,9 +376,9 @@ CommandResponse PMDPort::Init(const bess::pb::PMDPortArg &arg) {
eth_conf.lpbk_mode = 1;
}
if (arg.hwcksum()) {
eth_conf.rxmode.offloads = DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM |
DEV_RX_OFFLOAD_TCP_CKSUM;
eth_conf.rxmode.offloads = RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
RTE_ETH_RX_OFFLOAD_TCP_CKSUM;
}

ret = rte_eth_dev_configure(ret_port_id, num_rxq, num_txq, &eth_conf);
Expand Down Expand Up @@ -452,9 +459,10 @@ CommandResponse PMDPort::Init(const bess::pb::PMDPortArg &arg) {
}

int offload_mask = 0;
offload_mask |= arg.vlan_offload_rx_strip() ? ETH_VLAN_STRIP_OFFLOAD : 0;
offload_mask |= arg.vlan_offload_rx_filter() ? ETH_VLAN_FILTER_OFFLOAD : 0;
offload_mask |= arg.vlan_offload_rx_qinq() ? ETH_VLAN_EXTEND_OFFLOAD : 0;
offload_mask |= arg.vlan_offload_rx_strip() ? RTE_ETH_VLAN_STRIP_OFFLOAD : 0;
offload_mask |=
arg.vlan_offload_rx_filter() ? RTE_ETH_VLAN_FILTER_OFFLOAD : 0;
offload_mask |= arg.vlan_offload_rx_qinq() ? RTE_ETH_VLAN_EXTEND_OFFLOAD : 0;
if (offload_mask) {
ret = rte_eth_dev_set_vlan_offload(ret_port_id, offload_mask);
if (ret != 0) {
Expand Down
4 changes: 2 additions & 2 deletions core/modules/ip_checksum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ void IPChecksum::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
if (verify_) {
if (hw_) {
struct rte_mbuf *m = (struct rte_mbuf *)batch->pkts()[i];
if (unlikely((m->ol_flags & PKT_RX_IP_CKSUM_MASK) ==
PKT_RX_IP_CKSUM_BAD))
if (unlikely((m->ol_flags & RTE_MBUF_F_RX_IP_CKSUM_MASK) ==
RTE_MBUF_F_RX_IP_CKSUM_BAD))
EmitPacket(ctx, (bess::Packet *)m, FAIL_GATE);
else
EmitPacket(ctx, (bess::Packet *)m, FORWARD_GATE);
Expand Down
8 changes: 4 additions & 4 deletions core/modules/l4_checksum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ void L4Checksum::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
if (verify_) {
if (hw_) {
struct rte_mbuf *m = (struct rte_mbuf *)batch->pkts()[i];
if (unlikely((m->ol_flags & PKT_RX_L4_CKSUM_MASK) ==
PKT_RX_L4_CKSUM_BAD))
if (unlikely((m->ol_flags & RTE_MBUF_F_RX_L4_CKSUM_MASK) ==
RTE_MBUF_F_RX_L4_CKSUM_BAD))
EmitPacket(ctx, (bess::Packet *)m, FAIL_GATE);
else
EmitPacket(ctx, (bess::Packet *)m, FORWARD_GATE);
Expand All @@ -88,8 +88,8 @@ void L4Checksum::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
if (verify_) {
if (hw_) {
struct rte_mbuf *m = (struct rte_mbuf *)batch->pkts()[i];
if (unlikely((m->ol_flags & PKT_RX_L4_CKSUM_MASK) ==
PKT_RX_L4_CKSUM_BAD))
if (unlikely((m->ol_flags & RTE_MBUF_F_RX_L4_CKSUM_MASK) ==
RTE_MBUF_F_RX_L4_CKSUM_BAD))
EmitPacket(ctx, (bess::Packet *)m, FAIL_GATE);
else
EmitPacket(ctx, (bess::Packet *)m, FORWARD_GATE);
Expand Down
19 changes: 11 additions & 8 deletions deps/0001-af_packet-Avoid-set-ioctl-if-there-is-no-flag-diff.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SPDX-License-Identifier: Apache-2.0
Copyright 2019 Intel Corporation
Copyright 2019-present Intel Corporation

From e1bc63488d346cb84ae7e76f2bc480247f577abb Mon Sep 17 00:00:00 2001
From: Saikrishna Edupuganti <[email protected]>
Expand All @@ -17,33 +17,36 @@ https://gist.github.com/krsna1729/0c7160920343f9fa55f760c770286155
We also patch af_packet PMD to change set flags only when needed

Signed-off-by: Saikrishna Edupuganti <[email protected]>

[Updated]
From: "Arrobo, Gabriel" <[email protected]>
Date: Thu, 29 Feb 2024 11:34:41 -0800
---
drivers/net/af_packet/rte_eth_af_packet.c | 9 +++++++++
1 file changed, 9 insertions(+)
drivers/net/af_packet/rte_eth_af_packet.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f5806bf42..29d45eb47 100644
index c13a0942aa..e47aefb64c 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -472,6 +472,7 @@ static int
@@ -573,6 +573,7 @@ static int
eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
{
struct ifreq ifr;
+ uint32_t cur_flags;
int ret = 0;
int s;

@@ -484,8 +485,16 @@ eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
@@ -585,8 +586,15 @@ eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
ret = -errno;
goto out;
}
+
+ cur_flags = ifr.ifr_flags;
ifr.ifr_flags &= mask;
gab-arrobo marked this conversation as resolved.
Show resolved Hide resolved
ifr.ifr_flags |= flags;
+
+ // Return if there is no change
+ if (cur_flags == ifr.ifr_flags){
+ if (cur_flags == (uint32_t)ifr.ifr_flags){
+ goto out;
+ }
+
Expand Down
32 changes: 15 additions & 17 deletions deps/bpf_validate.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/lib/librte_bpf/bpf_impl.h b/lib/librte_bpf/bpf_impl.h
index b577e2c..f1d6f9a 100644
--- a/lib/librte_bpf/bpf_impl.h
+++ b/lib/librte_bpf/bpf_impl.h
@@ -21,7 +21,7 @@ struct rte_bpf {
diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index b4d8e87c6d..e659cd0b85 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -17,7 +17,7 @@ struct rte_bpf {
uint32_t stack_sz;
};

Expand All @@ -11,11 +11,11 @@ index b577e2c..f1d6f9a 100644

extern int bpf_jit(struct rte_bpf *bpf);

diff --git a/lib/librte_bpf/bpf_load.c b/lib/librte_bpf/bpf_load.c
index d9d163b..bd9eebf 100644
--- a/lib/librte_bpf/bpf_load.c
+++ b/lib/librte_bpf/bpf_load.c
@@ -115,7 +115,7 @@
diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c
index 1e17df6ce0..9bfc11fbc1 100644
--- a/lib/bpf/bpf_load.c
+++ b/lib/bpf/bpf_load.c
@@ -108,7 +108,7 @@ rte_bpf_load(const struct rte_bpf_prm *prm)
return NULL;
}

Expand All @@ -24,11 +24,11 @@ index d9d163b..bd9eebf 100644
if (rc == 0) {
bpf_jit(bpf);
if (mprotect(bpf, bpf->sz, PROT_READ) != 0)
diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c
index 83983ef..12c34f0 100644
--- a/lib/librte_bpf/bpf_validate.c
+++ b/lib/librte_bpf/bpf_validate.c
@@ -2209,7 +2209,7 @@ struct bpf_ins_check {
diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c
index 61cbb42216..2d3d899966 100644
--- a/lib/bpf/bpf_validate.c
+++ b/lib/bpf/bpf_validate.c
@@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf)
}

int
Expand All @@ -37,5 +37,3 @@ index 83983ef..12c34f0 100644
{
int32_t rc;
struct bpf_verifier bvf;
--

26 changes: 0 additions & 26 deletions deps/ethdev_include.patch

This file was deleted.

4 changes: 2 additions & 2 deletions env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ COPY . .

# Build DPDK testpmd (used in bessctl samples)
RUN ./build.py dpdk && \
cp /build/bess/deps/dpdk-20.11.3/build/app/dpdk-testpmd /usr/local/bin/ && \
rm -rf /build/bess
cp /build/bess/deps/dpdk-22.11.4/build/app/dpdk-testpmd /usr/local/bin/ && \
rm -rf /build/bess
amarsri28 marked this conversation as resolved.
Show resolved Hide resolved

ENV CCACHE_DIR=/tmp/ccache
ENV CCACHE_COMPRESS=true
2 changes: 1 addition & 1 deletion env/Dockerfile-cndp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ COPY pybess pybess
COPY sample_plugin sample_plugin
COPY build.py container_build.py install_git_hooks.sh ./
RUN ./build.py bess
RUN cp /build/bess/deps/dpdk-20.11.3/build/app/dpdk-testpmd /usr/local/bin/
RUN cp /build/bess/deps/dpdk-22.11.4/build/app/dpdk-testpmd /usr/local/bin/

ENV CCACHE_DIR=/tmp/ccache
ENV CCACHE_COMPRESS=true
Expand Down
1 change: 1 addition & 0 deletions env/build-dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- libgtest-dev
- python3
- python3-pip
- python3-pyelftools
- python3-setuptools
- pkg-config

Expand Down