Skip to content

Commit

Permalink
Moving to Linux 5.10.35
Browse files Browse the repository at this point in the history
  • Loading branch information
krizhanovsky committed Jun 8, 2021
1 parent b56326d commit dcfa777
Show file tree
Hide file tree
Showing 63 changed files with 533 additions and 2,035 deletions.
11 changes: 9 additions & 2 deletions ktest/linux/kernel.h
@@ -1,7 +1,7 @@
/**
* Tempesta kernel emulation unit testing framework.
*
* Copyright (C) 2015-2020 Tempesta Technologies, Inc.
* Copyright (C) 2015-2021 Tempesta Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -94,7 +94,7 @@ struct list_head {
struct list_head *next, *prev;
};

static inline void
static inline int
get_random_bytes_arch(void *buf, int nbytes)
{
#ifdef NO_RANDOM
Expand All @@ -119,6 +119,13 @@ get_random_bytes_arch(void *buf, int nbytes)
memcpy(buf, &l, nbytes);
}
#endif
return nbytes;
}

static inline void
get_random_bytes(void *buf, int nbytes)
{
get_random_bytes_arch(buf, nbytes);
}

#define DUMP_PREFIX_OFFSET 0
Expand Down
19 changes: 10 additions & 9 deletions ktest/linux/linkage.h
@@ -1,7 +1,7 @@
/**
* Tempesta kernel emulation unit testing framework.
*
* Copyright (C) 2020 Tempesta Technologies, Inc.
* Copyright (C) 2020-2021 Tempesta Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
Expand All @@ -21,19 +21,20 @@
#define __LINKAGE_H__

#define ASM_NL ;
#define SYM_L_GLOBAL .globl

#define ALIGN .align 4,0x90

#define ENTRY(name) \
.globl name ASM_NL \
ALIGN ASM_NL \
#define SYM_START(name, linkage, ALIGN) \
linkage name ASM_NL \
ALIGN,0x90 ASM_NL \
name:

#define END(name) \
#define SYM_FUNC_START(name) SYM_START(name, SYM_L_GLOBAL, .align 4)

#define SYM_CODE_END(name) \
.size name, .-name

#define ENDPROC(name) \
#define SYM_FUNC_END(name) \
.type name, @function ASM_NL \
END(name)
SYM_CODE_END(name)

#endif /* __LINKAGE_H__ */
3 changes: 1 addition & 2 deletions ktest/linux/skbuff.h
Expand Up @@ -40,7 +40,7 @@ struct sk_buff {

union {
ktime_t tstamp;
u64 skb_mstamp;
u64 skb_mstamp_ns;
};
};
struct rb_node rbnode; /* used in netem & tcp stack */
Expand Down Expand Up @@ -68,7 +68,6 @@ struct sk_buff {
fclone:2,
peeked:1,
head_frag:1,
xmit_more:1,
skb_page:1;

__u32 headers_start[0];
Expand Down
6 changes: 3 additions & 3 deletions lib/common.h
Expand Up @@ -21,11 +21,11 @@
#define __LIB_COMMON_H__

/* Get current timestamp in secs. */
static inline time_t
static inline long
tfw_current_timestamp(void)
{
struct timespec ts;
getnstimeofday(&ts);
struct timespec64 ts;
ktime_get_real_ts64(&ts);
return ts.tv_sec;
}

Expand Down
14 changes: 7 additions & 7 deletions lib/str_simd.S
Expand Up @@ -10,7 +10,7 @@
* The implementation doesn't use alignment function prologs since aligned
* version has shown worse performance, see the memcpy.c microbenchmark.
*
* Copyright (C) 2018-2019 Tempesta Technologies, Inc.
* Copyright (C) 2018-2021 Tempesta Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
Expand All @@ -30,7 +30,7 @@
#include <asm/alternative-asm.h>
#include <asm/export.h>

ENTRY(__memcpy_fast)
SYM_FUNC_START(__memcpy_fast)
movq %rdx, %rax
leaq 128(%rsi), %rcx
movq %rsi, %r8
Expand Down Expand Up @@ -135,9 +135,9 @@ ENTRY(__memcpy_fast)
movb %dl, (%rax)
.Lcpy_ret:
ret
ENDPROC(__memcpy_fast)
SYM_FUNC_END(__memcpy_fast)

ENTRY(__memcmp_fast)
SYM_FUNC_START(__memcmp_fast)
leaq (%rdi,%rdx), %rax
leaq 128(%rdi), %rcx
cmpq %rcx, %rax
Expand Down Expand Up @@ -267,9 +267,9 @@ ENTRY(__memcmp_fast)
movzbl %al, %eax
.Lcmp_ret:
ret
ENDPROC(__memcmp_fast)
SYM_FUNC_END(__memcmp_fast)

ENTRY(__bzero_fast)
SYM_FUNC_START(__bzero_fast)
movq %rsi, %rax
movq %rdi, %rdx
andq $-128, %rax
Expand Down Expand Up @@ -352,4 +352,4 @@ ENTRY(__bzero_fast)
movb $0, (%rax)
.Lbz_ret:
ret
ENDPROC(__bzero_fast)
SYM_FUNC_END(__bzero_fast)
18 changes: 3 additions & 15 deletions tempesta_db/core/file.c
Expand Up @@ -4,7 +4,7 @@
* File mapping and IO.
*
* Copyright (C) 2014 NatSys Lab. (info@natsys-lab.com).
* Copyright (C) 2015-2018 Tempesta Technologies.
* Copyright (C) 2015-2021 Tempesta Technologies.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -168,7 +168,6 @@ ma_free(unsigned long addr, int node)
static unsigned long
tempesta_map_file(struct file *file, unsigned long len, int node)
{
mm_segment_t oldfs;
MArea *ma;
loff_t off = 0;
unsigned long addr = -ENOMEM;
Expand All @@ -195,22 +194,17 @@ tempesta_map_file(struct file *file, unsigned long len, int node)

get_file(file);

oldfs = get_fs();
set_fs(get_ds());

addr = kernel_read(file, (char *)ma->start, len, &off);
if (addr != len) {
TDB_ERR("Cannot read %lu bytes to addr %p, ret = %ld\n",
len, (void *)ma->start, addr);
fput(file);
__ma_free(ma);
addr = -EIO;
goto err_fs;
goto err;
}

addr = ma->start;
err_fs:
set_fs(oldfs);
err:
mutex_unlock(&map_mtx);

Expand All @@ -225,7 +219,6 @@ static void
tempesta_unmap_file(struct file *file, unsigned long addr, unsigned long len,
int node)
{
mm_segment_t oldfs;
MArea *ma;
loff_t off = 0;
ssize_t r;
Expand All @@ -239,18 +232,13 @@ tempesta_unmap_file(struct file *file, unsigned long addr, unsigned long len,
goto err;
}

oldfs = get_fs();
set_fs(get_ds());

r = kernel_write(file, (void *)ma->start, len, &off);
if (r != len) {
TDB_WARN("Cannot sync mapping %lx of size %lu pages\n",
ma->start, ma->pages);
goto err_fs;
goto err;
}

err_fs:
set_fs(oldfs);
err:
fput(file);
ma_free(addr, node);
Expand Down
4 changes: 2 additions & 2 deletions tempesta_db/core/htrie.c
Expand Up @@ -27,9 +27,9 @@
* this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <asm/sync_bitops.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <asm/sync_bitops.h>

#include "lib/str.h"
#include "htrie.h"
Expand Down Expand Up @@ -924,7 +924,7 @@ tdb_htrie_init(void *p, size_t db_size, unsigned int rec_len)
p->d_wcl = tdb_alloc_blk(hdr);
}

TDB_DBG("init db header: nwb=%lu db_size=%lu rec_len=%u\n",
TDB_DBG("init db header: nwb=%llu db_size=%lu rec_len=%u\n",
atomic64_read(&hdr->nwb), hdr->dbsz, hdr->rec_len);

return hdr;
Expand Down
28 changes: 17 additions & 11 deletions tempesta_fw/addr.c
Expand Up @@ -444,26 +444,28 @@ tfw_put_dec(u32 q, char *out_buf)
*/
switch(digits_n) {
case 4:
r = (q * 0x0ccd) >> 15;
r = (q * 0x0ccd) >> 15;
out_buf[3] = (q - 10 * r) + '0';
q = (r * 0x00cd) >> 11;
q = (r * 0x00cd) >> 11;
out_buf[2] = (r - 10 * q) + '0';
fallthrough;
case 2:
r = (q * 0x000d) >> 7;
r = (q * 0x000d) >> 7;
out_buf[1] = (q - 10 * r) + '0';
out_buf[0] = r + '0';

break;
case 5:
r = (q * 0xcccd) >> 19;
r = (q * 0xcccd) >> 19;
out_buf[4] = (q - 10 * r) + '0';
q = (r * 0x0ccd) >> 15;
out_buf[3] = (r - 10 * q) + '0';
fallthrough;
case 3:
r = (q * 0x00cd) >> 11;
r = (q * 0x00cd) >> 11;
out_buf[2] = (q - 10 * r) + '0';
q = (r * 0x000d) >> 7;
q = (r * 0x000d) >> 7;
out_buf[1] = (r - 10 * q) + '0';
fallthrough;
case 1:
out_buf[0] = q + '0';
}
Expand All @@ -488,13 +490,17 @@ tfw_put_ipv6_digit_group(u16 group, char *out_buf)

switch(digits_n) {
case 4:
out_buf[-4] = hex_asc[(group >> 12) ];
out_buf[-4] = hex_asc[(group >> 12)];
fallthrough;
case 3:
out_buf[-3] = hex_asc[(group >> 8) & 0xF];
out_buf[-3] = hex_asc[(group >> 8) & 0xF];
fallthrough;
case 2:
out_buf[-2] = hex_asc[(group >> 4) & 0xF];
out_buf[-2] = hex_asc[(group >> 4) & 0xF];
fallthrough;
case 1:
out_buf[-1] = hex_asc[ group & 0xF];
out_buf[-1] = hex_asc[group & 0xF];
fallthrough;
}

return out_buf;
Expand Down

0 comments on commit dcfa777

Please sign in to comment.