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

RPM #528

Open
wants to merge 66 commits into
base: master
Choose a base branch
from
Open

RPM #528

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
2a22dd1
Just recovering old files from 2014. This does *not* work yet.
DirkHoffmann Mar 14, 2017
7e98751
Merge branch 'centos74-patch' (with patches from latest master) into rpm
DirkHoffmann Feb 12, 2018
06c8655
Adapted spec file to generate an RPM for the first time (on CentOS 7.4)
DirkHoffmann Feb 12, 2018
e69b159
extmem: user-supplied netmap memory region
giuseppelettieri Mar 21, 2017
bcb2af5
extmem: userspace support in nm_open()
giuseppelettieri Dec 1, 2017
22e6a77
testmmap: pools-info command
giuseppelettieri Apr 3, 2017
263cbb8
testmmap: read and write memory commands
giuseppelettieri Dec 20, 2017
b40f612
testmmap: simplify access to buffers
giuseppelettieri Dec 20, 2017
22d2fea
testmmap: ring and slot field modification
giuseppelettieri Jan 3, 2018
e58f03c
extmem: fix access out of bounds
giuseppelettieri Jan 3, 2018
6cfdaf6
extmem: always use kmap
giuseppelettieri Jan 3, 2018
e1aa46a
testmmap: fix input of forked processes
giuseppelettieri Jan 3, 2018
0ec3eb0
testmmap: use MAP_SHARED in anon-mmap
giuseppelettieri Jan 3, 2018
535d812
extmem: use a bitmap to record skipped objects
giuseppelettieri Jan 4, 2018
504b460
nm_open: do not overwrite arg1-3 if not requested
giuseppelettieri Jan 4, 2018
344de38
extmem: removed useless allocation
giuseppelettieri Jan 9, 2018
6537f69
extmem: allow sharing of allocator
giuseppelettieri Jan 9, 2018
d01c0d6
extmem: added support in nm_open/nm_parse
giuseppelettieri Jan 9, 2018
0ba57ec
extmem: pass extmem flag in pkt-gen
giuseppelettieri Jan 9, 2018
298dc01
netmap_mem_map: prefer objtotal over the internal _objtotal
giuseppelettieri Jan 9, 2018
126fa88
nm_open: disallow recursive memid specification
giuseppelettieri Jan 10, 2018
142ebbf
mem: large memory size support
micchie Dec 24, 2017
7e9e4de
unnecessary debug in the master
micchie Dec 28, 2017
c3a47a3
silence compiler
micchie Dec 28, 2017
465701e
FreeBSD: fix compilation
giuseppelettieri Jan 10, 2018
d535ef3
tlem: read head and tail only once
giuseppelettieri Jan 24, 2017
14b02d5
tlem: data structures and stubs for arp protocol
giuseppelettieri Jan 24, 2017
fd89c18
tlem: get mac addresses of ports
giuseppelettieri Jan 24, 2017
e73034c
tlem: obtain ip address and netmask
giuseppelettieri Jan 24, 2017
08ad533
tlem: send ARP replies
giuseppelettieri Jan 24, 2017
adcb748
tlem: close the socket after use
giuseppelettieri Jan 26, 2017
9af643f
tlem: fix cons/prod use of ipv4 info
giuseppelettieri Jan 26, 2017
d63de4a
tlem: process all pending arp commands
giuseppelettieri Jan 26, 2017
8aa4294
tlem: implement route-mode
giuseppelettieri Jan 27, 2017
b10ce92
tlem: better encapsulation of arp cmd queue
giuseppelettieri Jan 28, 2017
bb97816
tlem: filter out ARP messages we don't care about
giuseppelettieri Jan 28, 2017
27bf0b8
tlem: small refactoring
giuseppelettieri Jan 29, 2017
294fa8c
tlem: fix count of injected packets
giuseppelettieri Feb 3, 2017
238d4f9
tlem: drop non-routable packets in route-mode
giuseppelettieri Feb 10, 2017
0054c31
tlem: remove redundant parameters
giuseppelettieri Feb 10, 2017
610b9e2
tlem: default gateway option in route-mode
giuseppelettieri Feb 10, 2017
fe52b1d
tlem: get MAC in FreeBSD also
giuseppelettieri Feb 15, 2017
9800d39
tlem: check for proper IP address
giuseppelettieri Feb 15, 2017
87057c2
tlem: try to assign threads depending on available cores
giuseppelettieri Feb 15, 2017
2c503fd
tlem: some comments
giuseppelettieri Feb 27, 2017
61f1f58
tlem: retrive max priority from the kernel
giuseppelettieri Mar 10, 2017
d8070b1
tlem: pin buffer in memory
giuseppelettieri Mar 10, 2017
798dc52
tlem: drop packets when tx are too late
giuseppelettieri Mar 10, 2017
30ea6ce
tlem: initialize and check max_lag option
giuseppelettieri Apr 13, 2017
9f29282
pt: fix compilation after b6336b160
giuseppelettieri Jan 12, 2018
d4d4587
extmem: don't init bitmaps during creation
giuseppelettieri Jan 12, 2018
d061716
tlem: optionally use hugepages
giuseppelettieri Apr 14, 2017
3ddb873
tlem: do not continue if any allocation has failed
giuseppelettieri Apr 19, 2017
ef5ddd7
tlem: actually drop unwanted packets in route-mode
giuseppelettieri Apr 21, 2017
c89a731
nm_open: remove stale code
giuseppelettieri Jan 12, 2018
ea3a466
nm_open: more sensible handling of NM_OPEN_NO_MMAP
giuseppelettieri Jan 12, 2018
03d9d3f
tlem: add missing break in switch
giuseppelettieri Dec 18, 2017
22ec466
TLEM: output stats to mmap()ed file
giuseppelettieri Feb 9, 2018
464c093
tlem: also report dropped bytes
giuseppelettieri Feb 12, 2018
6391ceb
tlem: also report packets dropped by producer
giuseppelettieri Feb 12, 2018
43523fb
tlem: more uniform stat names
giuseppelettieri Feb 12, 2018
227fc31
tlem: packet reordering
giuseppelettieri Mar 15, 2018
5233077
v11.4: fix compatibility issue introduced by 142ebbf8e8f63f15596
vmaffione Apr 9, 2018
0dcf811
Merge tag 'v11.4' of https://github.com/luigirizzo/netmap into rpm
DirkHoffmann Jul 26, 2018
f7047a9
- Bumped version to netmap tag (11.4).
DirkHoffmann Jul 26, 2018
764f804
Moving RPM directory into more appropriate (because specific) LINUX s…
DirkHoffmann Aug 16, 2018
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ LINUX/scripts/conf
config.mak
*.rej
utils/producer
e1000e
i40e
igb
ixgbe
ixgbevf
19 changes: 19 additions & 0 deletions LINUX/RPM/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

HOWTO GENERATE RPM FILE
-----------------------

1) Edit netmap.spec! Increase at least revision number, but also add
something useful to the %changelog section.

2) Commit the changes. The RPM build will clone a fresh copy from git.

3) $ rpmbuild -ba RPM/netmap.spec
This (default) directory for your RPM builds may have been changed in
~/.rpmbuild (parameter %_topdir). Another favourite location is
/usr/src/redhat/.

3) Find result in ~/rpmbuild/RPMS and upload to repository
$ cd $rpmbuild/RPMS/x86_64/
$ ls -l
$ cp *.rpm $REPODIR/x86_64

85 changes: 85 additions & 0 deletions LINUX/RPM/netmap.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# RPMBUILD file for netmap in NectarCAM
# Dirk Hoffmann -CPPM-, 2014-2018
Name: netmap
Version: 11.4
Release: 1%{?dist}
Summary: Netmap distribution for CTA-North EVB
License: GPL
#URL: https://portal.cta-observatory.org/WP/MST/...???
#Source0: http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: linuxptp
BuildRequires: kernel-devel
Requires: kernel-x86_64 = 3.10.0-693.17.1
Requires: module-init-tools
Requires: kernel-devel

%description
The netmap driver with adapted network interface drivers e1000e, i40e, igb,
ixgbe, ixgbevf for CentOS/EL/SL 7 prepared for Cherenkov Telescope Array
by Julien Houles and Dirk Hoffmann -CPPM-.

%define kver %(uname -r)
%define kmod_dir /lib/modules/%{kver}

%prep
#%setup -q
rm -rf %{name}
#git clone https://github.com/luigirizzo/netmap.git
git clone https://github.com/DirkHoffmann/netmap.git --branch rpm


%build
cd %{name}
./configure --install-mod-path=%{buildroot} --prefix=%{buildroot}/usr
make %{?_smp_mflags}


%install
rm -rf %{buildroot}
cd %{name}
make install


%post
depmod
modprobe -r ixgbe
modprobe ixgbe


%postun
depmod
modprobe -r ixgbe
modprobe ixgbe


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc
%{kmod_dir}/extra
%{kmod_dir}/updates
%{_mandir}/*/*.gz
%attr(4755,root,root) %{_bindir}/*
%{_includedir}/net/*.h
%exclude %{kmod_dir}/modules.*

%changelog
* Fri Jul 27 2018 Dirk Hoffmann <[email protected]> - 11.4
- Bumping to the official netmap version (tag) number
- One (tiny) step back in kernel release number
* Mon Feb 12 2018 Dirk Hoffmann <[email protected]> - 2.0
- Pulled latest version from github
- Adapted to CentOS 7.4
* Mon Mar 14 2016 Dirk Hoffmann <[email protected]>
- Adapted to the "git-way of netmap distribution"
* Mon Sep 15 2014 Dirk Hoffmann <[email protected]>
- Binary is now suid'd
- Requiring kernel 3.16.2
* Wed Sep 10 2014 Dirk Hoffmann <[email protected]> - 1.0
- Initial version of the package

5 changes: 5 additions & 0 deletions LINUX/bsd_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

#include <linux/io.h> // virt_to_phys
#include <linux/hrtimer.h>
#include <linux/highmem.h> // kmap

#define KASSERT(a, b) BUG_ON(!(a))

Expand Down Expand Up @@ -181,6 +182,10 @@ static inline int skb_checksum_start_offset(const struct sk_buff *skb) {
#define NM_UNREG_NETDEV_NOTIF(nb) unregister_netdevice_notifier(nb)
#endif /* NETMAP_LINUX_HAVE_REG_NOTIF_RH */

#ifndef NETMAP_LINUX_HAVE_PAGE_TO_VIRT
#define page_to_virt(p) phys_to_virt(page_to_phys(p))
#endif /* NETMAP_LINUX_HAVE_PAGE_TO_VIRT */

/*----------- end of LINUX_VERSION_CODE dependencies ----------*/

/* Type redefinitions. XXX check them */
Expand Down
49 changes: 47 additions & 2 deletions LINUX/configure
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ setop()
}

# available subsystems
subsystem_avail="vale pipe monitor generic ptnetmap-guest ptnetmap-host sink"
subsystem_avail="vale pipe monitor generic ptnetmap-guest ptnetmap-host sink \
extmem"
#enabled subsystems (bitfield)
subsystem=0

Expand Down Expand Up @@ -305,9 +306,10 @@ Available options:
--disable-ptnetmap disable ptnetmap (both guest and host)
--enable-sink enable the netmap sink device
--disable-sink disable the netmap sink device
--enable-extmem enable the external memory allocators
--disable-extmem disable the external memory allocators
--force-debug build the modules w/ debug symbols (default)
--no-force-debug build the modules w/ or w/o debug symbols,
according to the kernel configuration
--cache= dir for reusing/caching of netmap_linux_config.h

--cc= C compiler to be used for the apps [$cc]
Expand Down Expand Up @@ -1498,6 +1500,49 @@ EOF
}
EOF

# check for get_user_pages_unlocked number of args
add_test 'have GUP_4ARGS' <<EOF
#include <linux/mm.h>

long
dummy(unsigned long start, unsigned long nr_pages,
struct page **pages, unsigned int gup_flags) {
return get_user_pages_unlocked(start, nr_pages, pages, gup_flags);
}
EOF

add_test 'have GUP_5ARGS' <<EOF
#include <linux/mm.h>

long
dummy(unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages) {
return get_user_pages_unlocked(start, nr_pages, write, force, pages);
}
EOF

add_test 'have GUP_7ARGS' <<EOF
#include <linux/mm.h>

long
dummy(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages) {
return get_user_pages_unlocked(tsk, mm, start, nr_pages,
write, force, pages);
}
EOF

# check for page_to_virt
add_test 'have PAGE_TO_VIRT' <<EOF
#include <linux/mm.h>

void *
dummy(struct page *page) {
return page_to_virt(page);
}
EOF

#####################################################
# checks related to drivers #
#####################################################
Expand Down
1 change: 0 additions & 1 deletion LINUX/if_e1000_netmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ static int e1000_netmap_init_buffers(struct SOFTC_T *adapter)
i = rxr->count - 1 - nm_kr_rxspace(&na->rx_rings[0]);
if (i < 0) // XXX something wrong here, can it really happen ?
i += rxr->count;
D("i now is %d", i);
wmb(); /* Force memory writes to complete */
writel(i, hw->hw_addr + rxr->rdt);
}
Expand Down
19 changes: 18 additions & 1 deletion LINUX/netmap_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ nm_os_malloc(size_t size)
return rv;
}

void *
nm_os_vmalloc(size_t size)
{
void *rv = vmalloc(size);
if (IS_ERR(rv))
return NULL;
return rv;
}

void *
nm_os_realloc(void *addr, size_t new_size, size_t old_size)
{
Expand All @@ -67,6 +76,11 @@ nm_os_free(void *addr){
kfree(addr);
}

void
nm_os_vfree(void *addr){
vfree(addr);
}

void
nm_os_selinfo_init(NM_SELINFO_T *si)
{
Expand Down Expand Up @@ -1033,7 +1047,8 @@ linux_netmap_mmap(struct file *f, struct vm_area_struct *vma)
{
int error = 0;
unsigned long off;
u_int memsize, memflags;
uint64_t memsize;
u_int memflags;
struct netmap_priv_d *priv = f->private_data;
struct netmap_adapter *na = priv->np_na;
/*
Expand All @@ -1057,6 +1072,8 @@ linux_netmap_mmap(struct file *f, struct vm_area_struct *vma)
(vma->vm_end - vma->vm_start), memsize);
if (off + (vma->vm_end - vma->vm_start) > memsize)
return -EINVAL;
if (memflags & NETMAP_MEM_EXT)
return -ENODEV;
if (memflags & NETMAP_MEM_IO) {
vm_ooffset_t pa;

Expand Down
6 changes: 3 additions & 3 deletions apps/pkt-gen/pkt-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ sender_body(void *data)
}
m = send_packets(txring, pkt, frame, size, targ->g,
limit, options, frags);
ND("limit %d tail %d frags %d m %d",
ND("limit %lu tail %d frags %d m %d",
limit, txring->tail, frags, m);
sent += m;
if (m > 0) //XXX-ste: can m be 0?
Expand Down Expand Up @@ -2953,7 +2953,7 @@ main(int arc, char **argv)
* reconfigure. We do the open here to have time to reset.
*/
flags = NM_OPEN_IFNAME | NM_OPEN_ARG1 | NM_OPEN_ARG2 |
NM_OPEN_ARG3 | NM_OPEN_RING_CFG;
NM_OPEN_ARG3 | NM_OPEN_EXTMEM | NM_OPEN_RING_CFG;
if (g.nthreads > 1) {
base_nmd.req.nr_flags &= ~NR_REG_MASK;
base_nmd.req.nr_flags |= NR_REG_ONE_NIC;
Expand All @@ -2965,7 +2965,7 @@ main(int arc, char **argv)
goto out;
}
g.main_fd = g.nmd->fd;
D("mapped %dKB at %p", g.nmd->req.nr_memsize>>10, g.nmd->mem);
D("mapped %uKB at %p", g.nmd->req.nr_memsize>>10, g.nmd->mem);

if (g.virt_header) {
/* Set the virtio-net header length, since the user asked
Expand Down
2 changes: 1 addition & 1 deletion apps/tlem/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SRCDIR ?= ../..
VPATH = $(SRCDIR)/apps/tlem

NO_MAN=
CFLAGS = -O2 -pipe
CFLAGS = -O2 -pipe -g
CFLAGS += -Werror -Wall -Wunused-function
CFLAGS += -I $(SRCDIR)/sys -I $(SRCDIR)/apps/include
CFLAGS += -Wextra
Expand Down
Loading