SUMMARY = "DPDK vSwitch" DESCRIPTION = "DPDK vSwitch is a fork of Open vSwitch. It re-creates the kernel forwarding module (data plane) \ by building the switching logic on top of the DPDK library to significantly boost packet switching throughput" HOMEPAGE = "https://01.org/packet-processing" SECTION = "networking" LICENSE = "Apache-2 & GPLv2 & LGPLv2.1 & BSD" LIC_FILES_CHKSUM = "file://openvswitch/COPYING;md5=eef486aeb68ddde5446062140eeda540 \ file://qemu/COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ file://qemu/COPYING.LIB;md5=79ffa0ec772fa86740948cb7327a0cc7 \ file://guest/ovs_client/ovs_client.c;beginline=1;endline=33;md5=8485efe01bb0513caf69f8bbec5617a0 \ " PV = "0.10.0" PACKAGES =+ "${PN}-controller ${PN}-switch ${PN}-pki ${PN}-qemu" DEPENDS += "dpdk virtual/kernel libtool glib-2.0 expect fuse python perl" RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \ python perl perl-module-strict sed gawk grep ${PN}-switch ${PN}-controller" RRECOMMENDS_${PN} += "kernel-module-openvswitch kernel-module-uio kernel-module-pci-stub" RDEPENDS_${PN}-ptest += "python-logging python-syslog python-argparse python-io \ python-fcntl python-shell python-lang python-xml python-math \ python-datetime python-netclient python sed ${PN}" RDEPENDS_${PN}-pki = "${PN}" ALLOW_EMPTY_${PN}-pki = "1" RDEPENDS_${PN}-controller += "${PN} lsb ${PN}-pki" RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen" OVS_PREFIX = "/opt/${PN}" FILES_${PN}-controller = "${sysconfdir}/init.d/openvswitchdpdk-controller \ ${sysconfdir}/default/openvswitchdpdk-controller \ ${OVS_PREFIX}/bin/ovs-controller \ " FILES_${PN}-doc += "/share/man" FILES_${PN} += "/share" FILES_${PN}-switch = "${sysconfdir}/init.d/openvswitchdpdk-switch \ ${sysconfdir}/default/openvswitchdpdk-switch" FILES_${PN}-qemu = "${QEMU_INSTALL_PATH}" inherit module-base update-rc.d INITSCRIPT_PACKAGES = "${PN}-switch ${PN}-controller" INITSCRIPT_NAME_${PN}-switch = "openvswitchdpdk-switch" #to enable at startup use bbappend recipe with INITSCRIPT_PARAMS_${PN}-switch = "defaults 71" INITSCRIPT_PARAMS_${PN}-switch = "stop 20 5 2 . stop 20 0 1 6 ." INITSCRIPT_NAME_${PN}-controller = "openvswitchdpdk-controller" #to enable at startup use bbappend recipe with INITSCRIPT_PARAMS_${PN}-controller = "defaults 72" INITSCRIPT_PARAMS_${PN}-controller = "stop 20 5 2 . stop 20 0 1 6 ." # Release 0.10.0 SRCREV = "28318e4004a9010b8bc15ff7e8ac5d886ea47857" SRC_URI = "git://github.com/01org/dpdk-ovs;branch=master \ file://configure-fix.patch \ file://makefile-install-rule.patch \ file://qemu-makefile.patch \ file://openvswitchdpdk-switch \ file://openvswitchdpdk-switch-setup \ file://openvswitchdpdk-controller \ file://openvswitchdpdk-controller-setup \ file://qemu-pixman-config.patch \ file://qemu-options-hx.patch \ file://0001-openvswitchdpdk-enabled-ptest.patch \ file://run-ptest \ file://ovs-ctl-dpdk.patch \ " S = "${WORKDIR}/git" B = "${S}" OVS_S_DIR = "${S}/openvswitch" QEMU_S_DIR = "${S}/qemu" # Install this modified qemu to a different place than the normal qemu QEMU_INSTALL_PATH = "/opt/dpdk-ovs-qemu" SRC_URI[md5sum] = "8d354e5f730292f126f29f85448cfc2d" SRC_URI[sha256sum] = "6256f9ca96716686030e4456e97eacc2f31b3169e65a1455f73ffafd78f7828a" export RTE_SDK = "${STAGING_DIR_HOST}/opt/dpdk" export RTE_TARGET = "x86_64-ivshmem-linuxapp-gcc" OVS_CONFIG_OPTS = "--build=${BUILD_SYS} \ --host=${HOST_SYS} \ --target=${TARGET_SYS} \ --prefix=${OVS_PREFIX} \ --disable-silent-rules \ --disable-ssl \ " QEMU_CONFIG_OPTS = "--prefix=${QEMU_INSTALL_PATH} \ --with-confsuffix="" \ --mandir=${QEMU_INSTALL_PATH}/share/man \ --docdir=${QEMU_INSTALL_PATH}/share/doc \ --datadir=${QEMU_INSTALL_PATH}/share \ --sysconfdir=${QEMU_INSTALL_PATH}/usr/etc \ --bindir=${QEMU_INSTALL_PATH}/bin \ --libdir=${QEMU_INSTALL_PATH}/lib \ --libexecdir=${QEMU_INSTALL_PATH}/libexec \ --includedir=${QEMU_INSTALL_PATH}/include \ --localstatedir=${QEMU_INSTALL_PATH}/var \ --enable-kvm \ --dpdkdir=${RTE_SDK} \ --extra-cflags="-Wno-poison-system-directories" \ --target-list=x86_64-softmmu \ --disable-strip \ " PACKAGESPLITFUNCS_prepend = "split_ovs_packages " #append OVS_PREFIX to all FILES_* in PACKAGES except for ptest, qemu, switch # and controller(includes exception, see FILES_${PN}-controller) packages python split_ovs_packages () { pkgs = d.getVar('PACKAGES', True) for pkg in pkgs.split(): if (pkg.endswith('-ptest') or pkg.endswith('-qemu') or pkg.endswith('-switch') or pkg.endswith('-controller')): continue files = d.getVar('FILES_%s' % pkg, True) if files is None: continue files = [d.getVar('OVS_PREFIX', True) + file for file in files.split()] files = ' '.join(files) d.setVar('FILES_%s' % pkg, files) } do_configure () { cd ${OVS_S_DIR} && ./boot.sh && ./configure ${OVS_CONFIG_OPTS} cd ${QEMU_S_DIR} && ./configure ${QEMU_CONFIG_OPTS} } do_compile () { cd ${OVS_S_DIR} && oe_runmake cd ${S}/guest/ovs_client && oe_runmake cd ${S}/guest/kni/kni_client && oe_runmake # unset the environment variables, so that oe_runmake will not override them unset bindir mandir docdir sysconfdir datadir libdir libexecdir includedir localstatedir cd ${QEMU_S_DIR} && oe_runmake } #use simple quotes in the definition of the following "OVS_" prefixed variables OVS_DPDK_PARAMS_DEFAULT = "-c 0x0f -n 4 --proc-type=primary --huge-dir /mnt/huge -- -p 0x03 -k 2 -n 4 --stats=1 --vswitchd=1 --client_switching_core=0 --config='(0,0,2),(1,0,3)'" OVS_VSWITCHD_PARAMS_DEFAULT = "-c 0x10 -n 4 --proc-type=secondary" #for debugging redirect to a regular file - this should be done temporary #if permanent logging is required a service like logrotate is recommended to limit the size of the log file OVS_DPDK_LOG_DEFAULT = "/dev/null" do_install () { cd ${OVS_S_DIR} && oe_runmake DESTDIR=${D} install install ${OVS_S_DIR}/datapath/dpdk/build/app/ovs_dpdk ${D}/${OVS_PREFIX}${base_bindir} install -d ${D}/${OVS_PREFIX}/share/${PN}/kmod install -m 644 ${OVS_S_DIR}/datapath/dpdk/fd_link/fd_link.ko ${D}/${OVS_PREFIX}/share/${PN}/kmod install -m 644 ${RTE_SDK}/${RTE_TARGET}/kmod/*.ko ${D}/${OVS_PREFIX}/share/${PN}/kmod install ${S}/guest/kni/kni_client/build/kni_client ${D}/${OVS_PREFIX}${base_bindir} install ${S}/guest/ovs_client/build/ovs_client ${D}/${OVS_PREFIX}${base_bindir} install -d ${D}/${sysconfdir}/default/ install -m 660 ${WORKDIR}/openvswitchdpdk-switch-setup ${D}/${sysconfdir}/default/openvswitchdpdk-switch install -m 660 ${WORKDIR}/openvswitchdpdk-controller-setup ${D}/${sysconfdir}/default/openvswitchdpdk-controller install -d ${D}/${sysconfdir}/init.d/ install -m 755 ${WORKDIR}/openvswitchdpdk-controller ${D}/${sysconfdir}/init.d/openvswitchdpdk-controller sed -i 's|INSTALLPREFIX=|INSTALLPREFIX=${OVS_PREFIX}|g' ${D}/${sysconfdir}/init.d/openvswitchdpdk-controller install -m 755 ${WORKDIR}/openvswitchdpdk-switch ${D}/${sysconfdir}/init.d/openvswitchdpdk-switch sed -i 's|INSTALLPREFIX=|INSTALLPREFIX=${OVS_PREFIX}|g' ${D}/${sysconfdir}/init.d/openvswitchdpdk-switch # Add DPDK default parameters to /etc/default/openvswitchdpdk-switch sed -i "s|@OVS_DPDK_PARAMS_DEFAULT|${OVS_DPDK_PARAMS_DEFAULT}|g" ${D}/${sysconfdir}/default/openvswitchdpdk-switch sed -i "s|@OVS_VSWITCHD_PARAMS_DEFAULT|${OVS_VSWITCHD_PARAMS_DEFAULT}|g" ${D}/${sysconfdir}/default/openvswitchdpdk-switch sed -i "s|@OVS_DPDK_LOG_DEFAULT|${OVS_DPDK_LOG_DEFAULT}|g" ${D}/${sysconfdir}/default/openvswitchdpdk-switch # Add DPDK default parameters to ovs-ctl sed -i "s|@OVS_DPDK_PARAMS_DEFAULT|${OVS_DPDK_PARAMS_DEFAULT}|g" ${D}/${OVS_PREFIX}/share/openvswitch/scripts/ovs-ctl sed -i "s|@OVS_VSWITCHD_PARAMS_DEFAULT|${OVS_VSWITCHD_PARAMS_DEFAULT}|g" ${D}/${OVS_PREFIX}/share/openvswitch/scripts/ovs-ctl sed -i "s|@OVS_DPDK_LOG_DEFAULT|${OVS_DPDK_LOG_DEFAULT}|g" ${D}/${OVS_PREFIX}/share/openvswitch/scripts/ovs-ctl install -d ${D}/${OVS_PREFIX}${sysconfdir}/openvswitch-controller # unset the environment variables, so that oe_runmake will not override them unset bindir mandir docdir sysconfdir datadir libdir libexecdir includedir localstatedir export STRIP="true" install -d ${D}/${QEMU_INSTALL_PATH}/bin cd ${QEMU_S_DIR} && oe_runmake DESTDIR=${D} install # silence QA error: architecture did not match rm -f ${D}/${QEMU_INSTALL_PATH}/share/openbios* rm -f ${D}/${QEMU_INSTALL_PATH}/share/palcode-clipper } pkg_postinst_${PN}-pki () { # can't do this offline if [ "x$D" != "x" ]; then exit 1 fi if test ! -d $D/${OVS_PREFIX}/share/${PN}/pki; then ${OVS_PREFIX}/${base_bindir}/ovs-pki init --dir=$D/${OVS_PREFIX}/share/${PN}/pki fi } pkg_postinst_${PN}-controller () { # can't do this offline if [ "x$D" != "x" ]; then exit 1 fi if test ! -d $D/${OVS_PREFIX}/share/${PN}/pki; then ${OVS_PREFIX}/${base_bindir}/ovs-pki init --dir=$D/${OVS_PREFIX}/share/${PN}/pki fi cd $D/${OVS_PREFIX}${sysconfdir}/openvswitch-controller if ! test -e cacert.pem; then ln -s $D/${OVS_PREFIX}/share/${PN}/pki/switchca/cacert.pem cacert.pem fi if ! test -e privkey.pem || ! test -e cert.pem; then oldumask=$(umask) umask 077 ${OVS_PREFIX}/${base_bindir}/ovs-pki req+sign --dir=$D/${OVS_PREFIX}/share/${PN}/pki tmp controller >/dev/null mv tmp-privkey.pem privkey.pem mv tmp-cert.pem cert.pem mv tmp-req.pem req.pem chmod go+r cert.pem req.pem umask $oldumask fi } inherit ptest EXTRA_OEMAKE += "TEST_DEST=${D}${PTEST_PATH} TEST_ROOT=${PTEST_PATH}" do_install_ptest() { cd ${OVS_S_DIR} && oe_runmake test-install sed -i 's|INSTALLPREFIX=|INSTALLPREFIX=${OVS_PREFIX}|g' ${D}${PTEST_PATH}/run-ptest } # for qemu/pixman configuration export HOST_SYS INHIBIT_PACKAGE_DEBUG_SPLIT = "1" INSANE_SKIP_${PN} = "installed-vs-shipped"