Skip to content
Open
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
6 changes: 3 additions & 3 deletions bessctl/sugar.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from __future__ import print_function
import re
import tokenize
import parser
import ast
import io

'''
Expand Down Expand Up @@ -171,8 +171,8 @@ def is_gate_expr(exp, is_ogate):
exp_stripped = exp_stripped[:-1].strip()

try:
parser.expr('(%s)' % exp_stripped)
parser.expr('%s%s%s' % (prefix, exp, postfix))
ast.parse('(%s)' % exp_stripped, mode='eval')
ast.parse('%s%s%s' % (prefix, exp, postfix), mode='eval')
except SyntaxError:
return False
else:
Expand Down
24 changes: 24 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,26 @@
import subprocess
import textwrap
import argparse
import platform
from packaging import version

def get_kernel_version():
try:
kernel_ver = platform.release().split('-')[0]
return kernel_ver
except Exception as e:
print(f"Error getting kernel version: {e}")
return None

def is_kernel_version_grtr_eq(version_to_check):
"""
Check if current kernel version is equal to the specified version
Example: is_kernel_version_equal("5.15.0")
"""
current_version = get_kernel_version()
if current_version:
return version.parse(current_version) >= version.parse(version_to_check)
return False

def cmd(cmd, quiet=False, shell=False):
"""
Expand Down Expand Up @@ -338,6 +357,11 @@ def build_dpdk():
configure_dpdk()

for f in glob.glob('%s/*.patch' % DEPS_DIR):
# skip the kernel 5.9 patch if we running under v5.9
is_5_9_patch = "linux_5_9.patch" in f
is_wrong_kernel = not is_kernel_version_grtr_eq("5.9.0")
if is_5_9_patch and is_wrong_kernel:
continue
print('Applying patch %s' % f)
cmd('patch -d %s -N -p1 < %s || true' % (DPDK_DIR, f), shell=True)

Expand Down
8 changes: 4 additions & 4 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ endif

# We always want these libraries to be dynamically linked even when the
# user requests a static build.
ALWAYS_DYN_LIBS := -lpthread -ldl
ALWAYS_DYN_LIBS := -lpcap -lpthread -ldl -lgrpc++
# These libraries are not supported by pkg-config.
ALWAYS_LIBS := -lpcap -lgflags -lnuma
ALWAYS_LIBS := -lgflags -lnuma
# If pkg-config is available, we just need a list of the dependecies.
PKG_CONFIG_DEPS := libglog protobuf grpc++ libunwind zlib
PKG_CONFIG_DEPS := libglog protobuf
# If pkg-config is not available, we need to list the libs we depend on.
NO_PKG_CONFIG_LIBS := -lglog -lgflags -lprotobuf -lgrpc++ -lunwind -lz
NO_PKG_CONFIG_LIBS := -lglog -lgflags -lprotobuf
# If pkg-config is not available and we're static linking, we also need
# the indirect dependecies. This is annoying, because they may change
# in future versions.
Expand Down
1 change: 1 addition & 0 deletions core/kmod/sn_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sn_common.h"
#include "sn_kernel.h"
#include "../snbuf_layout.h"
#include <linux/ethtool.h>

#define NUM_STATS_PER_TX_QUEUE (sizeof(struct sn_queue_tx_stats) / sizeof(u64))
#define NUM_STATS_PER_RX_QUEUE (sizeof(struct sn_queue_rx_stats) / sizeof(u64))
Expand Down
4 changes: 2 additions & 2 deletions core/modules/l2_forward.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static uint64_t l2_addr_to_u64(char *addr) {

static void l2_forward_init_test() {
int ret;
struct l2_table l2tbl;
struct l2_table l2tbl = {};

ret = l2_init(&l2tbl, 0, 0);
DCHECK_LT(ret, 0);
Expand Down Expand Up @@ -445,7 +445,7 @@ static void l2_forward_entry_test() {

static void l2_forward_flush_test() {
int ret;
struct l2_table l2tbl;
struct l2_table l2tbl = {};

uint64_t addr1 = 0x0123456701234567;
uint16_t index1 = 0x0123;
Expand Down
3 changes: 3 additions & 0 deletions core/utils/exact_match_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ class ExactMatchTable {
return MakeError(EINVAL,
Format("idx %d is not in [0,%d)", idx, MAX_FIELDS));
}
if (m == nullptr) {
return MakeError(EINVAL, Format("idx %d: module pointer is null", idx));
}
ExactMatchField *f = &fields_[idx];
f->size = field.size;
if (f->size < 1 || f->size > MAX_FIELD_SIZE) {
Expand Down
44 changes: 44 additions & 0 deletions deps/linux_5_9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c
index 039f5a5f63..57d0c58ab1 100644
--- a/kernel/linux/igb_uio/igb_uio.c
+++ b/kernel/linux/igb_uio/igb_uio.c
@@ -236,7 +236,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
}
#endif

- /* falls through - to MSI */
+ fallthrough;
case RTE_INTR_MODE_MSI:
#ifndef HAVE_ALLOC_IRQ_VECTORS
if (pci_enable_msi(udev->pdev) == 0) {
@@ -255,7 +255,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
#endif
- /* falls through - to INTX */
+ fallthrough;
case RTE_INTR_MODE_LEGACY:
if (pci_intx_mask_supported(udev->pdev)) {
dev_dbg(&udev->pdev->dev, "using INTX");
@@ -265,7 +265,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
dev_notice(&udev->pdev->dev, "PCI INTX mask not supported\n");
- /* falls through - to no IRQ */
+ fallthrough;
case RTE_INTR_MODE_NONE:
udev->mode = RTE_INTR_MODE_NONE;
udev->info.irq = UIO_IRQ_NONE;
diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
index 5e75c6371f..4f36b23fe7 100644
--- a/kernel/linux/kni/kni_dev.h
+++ b/kernel/linux/kni/kni_dev.h
@@ -101,7 +101,7 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk,
offset = iova & (PAGE_SIZE - 1);

/* Read one page struct info */
- ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
+ ret = get_user_pages_remote(tsk->mm, iova, 1,
FOLL_TOUCH, &page, NULL, NULL);
if (ret < 0)
return 0;