@@ -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()
113117drv 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
118121edrv ()
119122{
120123 setop external_driver " $@ "
@@ -126,6 +129,21 @@ edrv enable ixgbe
126129edrv enable ixgbevf
127130edrv 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
130148application_avail=" pkt-gen bridge lb tlem nmreplay vale-ctl"
131149application=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
405423ifneq (\$ (KERNELRELEASE),)
406424obj-m := $TESTOBJS
407425else
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 )
411429all: \$ (S_DRIVERS:%=get-%) \$ (E_DRIVERS:%=build-%) \$ (I_DRIVERS:%=patch-%) tests
412430
413431tests:
@@ -580,6 +598,9 @@ for opt do
580598 esac
581599done
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; }
672693fi
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-
681695ln -s $SRCDIR /read-vars.mak 2> /dev/null || true
682696rm -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
686700src_checked=
687701src_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
701742We are trying to download the original sources for driver
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
820837EOF
821838done
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+ }
12581281EOF
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 }
14421465EOF
@@ -1609,10 +1632,6 @@ EOF
16091632
16101633fi # ! -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
16171636for f in $SRCDIR /* .in; do
16181637 replace_vars $f > $( basename $f .in)
0 commit comments