- Add multi pseudo network interface support for vkernel
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 14 Jan 2007 14:24:56 +0000 (14:24 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 14 Jan 2007 14:24:56 +0000 (14:24 +0000)
commitd53b52ae70dfc678105f9e6020e51e16ca2f6943
treec28e5df5a424369a43fdf92ed56aedf4222d0c10
parent3f4985cd76da330e7bf510d20299ad467c9ec45e
- Add multi pseudo network interface support for vkernel
- Add two sysctl for vke(4):
  o  hw.vkeX.intr_rate -- pseudo interrupt rate
  o  hw.vkeX.tap_unit  -- backend real kernel tap(4) interface unit
- Print backend tap(4) interface name in vkernel for 'ifconfig vkeX'

vke(4)s are created according to the following command line option:

-I tap_devname[:expression]

'tap_devname' can be:
1) auto                pick up the first unused tap(4) device file in /dev
2) tapX                use /dev/tapX as tap(4) device file
3) /path/to/tap_dev    use /path/to/tap_dev as tap(4) device file

'expression' is optional and could be:
1) x.x.x.x             tap(4)'s address is x.x.x.x

2) x.x.x.x/z           tap(4)'s address is x.x.x.x
                       tap(4)'s netmask len is z

3) x.x.x.x:y.y.y.y     tap(4)'s address is x.x.x.x
                       vke(4)'s address is y.y.y.y

4) x.x.x.x:y.y.y.y/z   tap(4)'s address is x.x.x.x
                       vke(4)'s address is y.y.y.y
                       tap(4) and vke(4)'s netmask len are z

5) bridgeX             tap(4) will be added to bridgeX

6) bridgeX:y.y.y.y     tap(4) will be added to bridgeX
                       vke(4)'s address is y.y.y.y

7) bridgeX:y.y.y.y/z   tap(4) will be added to bridgeX
                       vke(4)'s address is y.y.y.y
                       vke(4)'s netmask len is z

vke(4)'s unit will be in the same order as the -I command line option,
i.e. first -I option will create vke0, and the second -I option will
create vke1 etc...

If vke(4)'s address/netmask is supplied, then in vkernel 'ifconfig vkeX up'
will assign the supplied address/netmask to vkeX in addition to bringing
vkeX up.

NOTE:
1) bridgeX will not be created if it does not exist yet
2) bridgeX will not be brought up if it is not up yet
3) if_tap.ko and if_bridge.ko will not be loaded automaticly
The main reason for 1) and 2), is that bridgeX will be in its original
state when vkernel is stopped normally or abruptly.

So if you choose to utilize bridged tap(4), before starting vkernel, you
will have to do following to make vke(4) work (suppose we use re0 as real
network interface):
# kldload if_bridge.ko
# kldload if_tap.ko
# ifconfig re0 up
# ifconfig bridge0 create
# ifconfig bridge0 addm re0
# ifconfig bridge0 up

Approved-by: dillon@
sys/dev/virtual/net/if_vke.c
sys/platform/vkernel/include/md_var.h
sys/platform/vkernel/platform/init.c