Ejemplo n.º 1
0
def configure():

    cmd = "/usr/lib/twister/scripts/dpdk_nic_bind.py"
    twister_conf = "/etc/twister/twister.conf"
    twister_api = "/etc/twister/twister_api.json"
    dpdk_drv = "igb_uio"
    dpdk_kernel_module = "/usr/lib/twister/modules/igb_uio.ko"

    load_dpdk_module(dpdk_kernel_module)
    lib_dpdk.check_modules()
    lib_dpdk.get_nic_details()
    devices = lib_dpdk.devices

    bind_all_to_linux(cmd, devices)
    lib_dpdk.get_nic_details()
    config = ConfigParser.RawConfigParser()
    config.readfp(open(twister_conf))

    whitelist = get_whitelist(devices, config)
    blacklist = get_blacklist(devices, config)
    coremask = get_coremask(config)

    if not set(whitelist).isdisjoint(blacklist):
        raise Exception("whitelist conflicts with blacklist in twister.conf")

    if not set(whitelist).issubset(devices.keys()):
        raise Exception("whitelist interfaces in twister.conf do not exist")

    portmask = get_portmask(whitelist)
    for device in whitelist:
        out, err = bind_device(cmd, device, dpdk_drv)

    twister_json = {
        "coremask": coremask,
        "portmask": portmask,
        "blacklist": blacklist
    }
    with open(twister_api, 'w') as outfile:
        json.dump(twister_json, outfile)
Ejemplo n.º 2
0
def main():
    cmd = "/home/twister/config/dpdk_nic_bind.py"
    twister_conf = "/home/twister/config/twister.conf"
    twister_api = "/home/twister/config/twister_api.json"
    dpdk_drv = "igb_uio"

    lib_dpdk.check_modules()
    lib_dpdk.get_nic_details()
    devices = lib_dpdk.devices

    bind_all_to_linux(cmd, devices)

    config = ConfigParser.RawConfigParser()
    config.readfp(open(twister_conf))

    whitelist = get_whitelist(devices, config)
    blacklist = get_blacklist(devices, config)
    coremask = get_coremask(config)

    if not set(whitelist).isdisjoint(blacklist):
        raise Exception("whitelist conflicts with blacklist in twister.conf")

    if not set(whitelist).issubset(devices.keys()):
        raise Exception("whitelist interfaces in twister.conf do not exist")

    portmask = hex(len(whitelist))

    for device in whitelist:
        out, err = bind_device(cmd, device, dpdk_drv)

    twister_json = {"coremask": coremask,
                    "portmask": portmask,
                    "blacklist": blacklist}
    with open(twister_api, 'w') as outfile:
        json.dump(twister_json, outfile)

    print twister_json
Ejemplo n.º 3
0
 def run_dpdk_lspci (self):
     dpdk_nic_bind.get_nic_details()
     self.m_devices= dpdk_nic_bind.devices
Ejemplo n.º 4
0
 def run_dpdk_lspci (self):
     dpdk_nic_bind.get_nic_details()
     self.m_devices= dpdk_nic_bind.devices