Skip to content

Commit 44662b1

Browse files
Merge branch 'master' into github-master
2 parents 92553ac + 618e9a0 commit 44662b1

7 files changed

Lines changed: 294 additions & 217 deletions

File tree

LINUX/README

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ features, namely:
7171

7272
netmap subsystems
7373
-----------------
74-
74+
7575
These are optional parts of netmap that can be compiled in with
7676
--enable-SUBSYSTEM and commented out with --disable-SUBSYSTEM.
7777
The available subsystems the following (the starred ones are enabled
@@ -110,16 +110,16 @@ features, namely:
110110
the host OS already supplies a driver. The optimal performance, however,
111111
is only obtained with netmap-enabled NIC drivers. The configure script
112112
implements two methods to obtain the netmap-enabled drivers:
113-
113+
114114
1. patching the native drivers that come with your kernel;
115115
2. patching NIC-vendors out-of-tree drivers selected by us.
116-
116+
117117
Both methods have advantages and drawbacks and none is perfect.
118118
In method 1 the patches we supply may fail to apply (especially on
119119
Red Hat based distributions), but compilation of successfully patched
120120
drivers usually works. In method 2 the patches will be guaranteed to
121121
apply, but compilation may fail since the out-of-tree drivers may
122-
not support your kernel.
122+
not support your kernel.
123123

124124
By default e1000e, i40e, ixgbe, ixgbevf and igb use method 2, while
125125
e1000, r8169.c, forcedeth.c, veth.c and virtio_net.c drivers use method
@@ -149,7 +149,7 @@ features, namely:
149149
external module compilation is available and there is typically
150150
no need to supply it, since configure is already able to find
151151
it in the standard place.
152-
152+
153153
The configure script selects the patch to apply based only on the
154154
kernel version. Moreover, we only supply patches for the vanilla kernel
155155
from the Torvalds repository (not even the stable kernels). If the
@@ -298,4 +298,4 @@ DETAILS
298298
+ if_e1000_e uses regular descriptor up 3.1 at least
299299
3.2.32 is reported to use extended descriptors
300300
(in my repo updated at -r 11975)
301-
301+

LINUX/configure

Lines changed: 67 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ setop()
2828

2929
case "$2" in
3030
new)
31-
eval "$1_avail=\$$3_avail; $1=\$$3"
31+
eval "$1_avail=\$$3_avail; $1="
32+
return
33+
;;
34+
copy)
35+
eval "$1=\$$3"
3236
return
3337
;;
3438
intersect)
@@ -113,8 +117,7 @@ drv()
113117
drv enable-all
114118

115119
# drivers built by external commands (subset of driver)
116-
external_driver_avail=$driver_avail
117-
external_driver=
120+
setop external_driver new driver
118121
edrv()
119122
{
120123
setop external_driver "$@"
@@ -126,6 +129,21 @@ edrv enable ixgbe
126129
edrv enable ixgbevf
127130
edrv enable i40e
128131

132+
# drivers built by patching the system drivers
133+
setop internal_driver new driver
134+
idrv()
135+
{
136+
setop internal_driver "$@"
137+
}
138+
139+
update_drivers() {
140+
edrv intersect driver
141+
idrv copy driver
142+
idrv subtract external_driver
143+
}
144+
145+
update_drivers
146+
129147
# available apps
130148
application_avail="pkt-gen bridge lb tlem nmreplay vale-ctl"
131149
application=0
@@ -232,9 +250,9 @@ replace_vars()
232250
-e "s|@LIN_VER@|$lin_ver|g" \
233251
-e "s|@MOD_LIST@|$mod_list|g" \
234252
-e "s|@PATCHES@|$(echo $patches)|g" \
235-
-e "s|@S_DRIVERS@|$(echo $s_drivers)|g" \
236-
-e "s|@E_DRIVERS@|$(echo $e_drivers)|g" \
237-
-e "s|@I_DRIVERS@|$(echo $i_drivers)|g" \
253+
-e "s|@S_DRIVERS@|$(drv print)|g" \
254+
-e "s|@E_DRIVERS@|$(edrv print)|g" \
255+
-e "s|@I_DRIVERS@|$(idrv print)|g" \
238256
-e "s|@DRVSUFFIX@|$drvsuffix|g" \
239257
-e "s|@APPS_LIST@|$(app print)|g" \
240258
-e "s|@APPS_CC@|$cc|g" \
@@ -405,9 +423,9 @@ SRCDIR=$SRCDIR
405423
ifneq (\$(KERNELRELEASE),)
406424
obj-m := $TESTOBJS
407425
else
408-
S_DRIVERS := $s_drivers
409-
E_DRIVERS := $e_drivers
410-
I_DRIVERS := $i_drivers
426+
S_DRIVERS := $(drv print)
427+
E_DRIVERS := $(edrv print)
428+
I_DRIVERS := $(idrv print)
411429
all: \$(S_DRIVERS:%=get-%) \$(E_DRIVERS:%=build-%) \$(I_DRIVERS:%=patch-%) tests
412430
413431
tests:
@@ -580,6 +598,9 @@ for opt do
580598
esac
581599
done
582600

601+
# update the divers subsets so that they are all consistent
602+
update_drivers
603+
583604
####################################################################
584605
################### START OF PROCESSING ############################
585606
####################################################################
@@ -671,21 +692,16 @@ if ! drv is-empty; then
671692
[ -d patches ] || { rm -f patches; ln -s $SRCDIR/final-patches patches; }
672693
fi
673694

674-
s_drivers=$(drv print)
675-
edrv intersect driver
676-
e_drivers=$(edrv print)
677-
setop internal_driver new driver
678-
setop internal_driver subtract external_driver
679-
i_drivers=$(setop internal_driver print)
680-
681695
ln -s $SRCDIR/read-vars.mak 2>/dev/null || true
682696
rm -f drivers.mak
683697
# read in all the kernel .config, we use it below
684698
. $ksrc/.config
685699
# check for full kernel sources just once
686700
src_checked=
687701
src_found=
688-
for d in $s_drivers; do
702+
# cache
703+
e_drivers=$(edrv print)
704+
for d in $(drv print); do
689705
# reset all driver variables to default values
690706
drv_fetch=
691707
drv_src=
@@ -696,6 +712,31 @@ for d in $s_drivers; do
696712
# possibly override from config.mak
697713
eval $(make -nrf read-vars.mak $d@vars E_DRIVERS="$e_drivers")
698714

715+
# check that the original driver had been compiled as a module, otherwise
716+
# skip this driver
717+
# (we do this mainly to be sure that any module dependency has already
718+
# been taken care of)
719+
# XXX maybe add a (per driver?) flag to force compilation anyway
720+
m="$(eval echo \$$drv_conf)"
721+
[ -n "$m" ] || {
722+
echo "$drv_conf not set in $ksrc/.config, skipping $d" | warning
723+
drv disable $d
724+
continue
725+
}
726+
[ "$m" = y ] && [ -z "$drvsuffix" ] && {
727+
warning <<EOF
728+
The $d driver is not compiled as a module:
729+
you will not be able to load the netmap enabled driver on this kernel.
730+
Please consider setting
731+
732+
$drv_conf=m
733+
734+
in your .config.
735+
736+
Alternatively, you can pass a --driver-suffix= option to configure.
737+
EOF
738+
}
739+
699740
if [ -n "$drv_fetch" ]; then
700741
message " NOTE " <<EOF
701742
We are trying to download the original sources for driver
@@ -781,30 +822,6 @@ EOF
781822
elif [ "$drv_patch" = none ]; then
782823
drv_patch=
783824
fi
784-
# check that the original driver had been compiled as a module, otherwise
785-
# skip this driver
786-
# (we do this mainly to be sure that any module dependency has already
787-
# been taken care of)
788-
# XXX maybe add a (per driver?) flag to force compilation anyway
789-
m="$(eval echo \$$drv_conf)"
790-
[ -n "$m" ] || {
791-
echo "$drv_conf not set in $ksrc/.config, skipping $d" | warning
792-
drv disable $d
793-
continue
794-
}
795-
[ "$m" = y ] && [ -z "$drvsuffix" ] && {
796-
warning <<EOF
797-
The $d driver is not compiled as a module:
798-
you will not be able to load the netmap enabled driver on this kernel.
799-
Please consider setting
800-
801-
$drv_conf=m
802-
803-
in your .config.
804-
805-
Alternatively, you can pass a --driver-suffix= option to configure.
806-
EOF
807-
}
808825

809826
# if no external build command has been specified, add
810827
# this driver to the list of modules built by netmap,
@@ -820,6 +837,10 @@ $d@patch := $drv_patch
820837
EOF
821838
done
822839

840+
# update the subsets again since the above checks
841+
# may have disabled some driver
842+
update_drivers
843+
823844
#################################################
824845
# create the config.h file
825846
#################################################
@@ -1253,8 +1274,10 @@ EOF
12531274
add_test 'have XMIT_MORE' <<EOF
12541275
#include <linux/skbuff.h>
12551276
1256-
struct sk_buff *skb;
1257-
(void)skb->xmit_more;
1277+
unsigned int
1278+
dummy(struct sk_buff *skb) {
1279+
return skb->xmit_more;
1280+
}
12581281
EOF
12591282

12601283
# arguments of skb_add_rx_frag (either 5 or 6)
@@ -1436,7 +1459,7 @@ EOF
14361459
#include "ixgbe/ixgbe_main.c"
14371460
14381461
void
1439-
dummy(struct ixgbe_adapter *adater, u64 qmask) {
1462+
dummy(struct ixgbe_adapter *adapter, u64 qmask) {
14401463
ixgbe_irq_disable_queues(adapter, qmask);
14411464
}
14421465
EOF
@@ -1609,10 +1632,6 @@ EOF
16091632

16101633
fi # ! -f $cache/netmap_config_h
16111634

1612-
# get the drivers that are still enabled
1613-
s_drivers=$(drv print)
1614-
e_drivers=$(edrv print)
1615-
16161635
# create netmap.mak and Kbuild
16171636
for f in $SRCDIR/*.in; do
16181637
replace_vars $f > $(basename $f .in)

LINUX/netmap_linux.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,14 @@ EXPORT_SYMBOL(netmap_bdg_name); /* the bridge the vp is attached to */
21962196
EXPORT_SYMBOL(netmap_disable_all_rings);
21972197
EXPORT_SYMBOL(netmap_enable_all_rings);
21982198
EXPORT_SYMBOL(netmap_krings_create);
2199-
2199+
EXPORT_SYMBOL(netmap_krings_delete); /* used by veth module */
2200+
EXPORT_SYMBOL(netmap_mem_rings_create); /* used by veth module */
2201+
EXPORT_SYMBOL(netmap_mem_rings_delete); /* used by veth module */
2202+
#ifdef WITH_PIPES
2203+
EXPORT_SYMBOL(netmap_pipe_txsync); /* used by veth module */
2204+
EXPORT_SYMBOL(netmap_pipe_rxsync); /* used by veth module */
2205+
#endif /* WITH_PIPES */
2206+
EXPORT_SYMBOL(netmap_verbose);
22002207

22012208
MODULE_AUTHOR("http://info.iet.unipi.it/~luigi/netmap/");
22022209
MODULE_DESCRIPTION("The netmap packet I/O framework");

0 commit comments

Comments
 (0)