Exemplo n.º 1
0
 def __init__(self):
     super().__init__()
     # Pending testcase database
     self.ptcdb = objects.ObjectDatabase()
     # Completed testcase database
     self.ctcdb = objects.ObjectDatabase()
     return
Exemplo n.º 2
0
 def CreateSlabs(self, spec):
     logger.debug("In CreateSlabs, Endpoint %s" % (self.GID()))
     self.slab_allocator = objects.TemplateFieldObject("range/0/2048")
     self.slabs = objects.ObjectDatabase()
     self.mr_slabs = objects.ObjectDatabase()
     self.obj_helper_slab = slab.SlabObjectHelper()
     self.obj_helper_slab.Generate(self.intf.lif, spec)
     self.slabs.SetAll(self.obj_helper_slab.slabs)
     self.mr_slabs.SetAll(self.obj_helper_slab.slabs)
     self.total_mr_slabs += len(self.mr_slabs)
Exemplo n.º 3
0
 def CreateCqs(self, spec):
     self.cqs = objects.ObjectDatabase()
     self.obj_helper_cq = cq.CqObjectHelper()
     self.obj_helper_cq.Generate(self, spec)
     if len(self.obj_helper_cq.cqs):
         self.cqs.SetAll(self.obj_helper_cq.cqs)
     logger.debug("In CreateCqs, Endpoint %s" % (self.GID()))
Exemplo n.º 4
0
 def Init(self, queue_type, spec):
     self.queue_type = queue_type
     self.id = queue_type.GetQid()
     self.GID(str(self.id))
     self.rings = objects.ObjectDatabase()
     self.obj_helper_ring = ring.NvmeRingObjectHelper()
     self.obj_helper_ring.Generate(self, spec)
     self.rings.SetAll(self.obj_helper_ring.rings)
Exemplo n.º 5
0
 def CreateSlabs(self):
     logger.debug("In CreateSlabs, NVMe LIF %s" % (self.GID()))
     self.slab_allocator = objects.TemplateFieldObject("range/0/2048")
     self.slabs = objects.ObjectDatabase()
     self.obj_helper_slab = slab.SlabObjectHelper()
     self.obj_helper_slab.Generate2(self, self.total_slabs, self.spec.host_page_size, self.spec.host_page_size)
     self.obj_helper_slab.Configure()
     self.slabs.SetAll(self.obj_helper_slab.slabs)
Exemplo n.º 6
0
    def Init(self, lif, spec):
        self.GID(spec.id)
        self.lif        = lif
        self.spec       = spec
        self.id         = spec.id
        self.type       = spec.type
        self.purpose    = spec.purpose.upper()
        self.size       = spec.size
        self.count      = spec.count
        self.entries    = None

        self.queueid_allocator = objects.TemplateFieldObject("range/0/16384")

        self.queues = objects.ObjectDatabase()
        self.need_type_specific_configure = True
        if spec.id in eth_queue_type_ids:
            self.obj_helper_q = eth_queue.EthQueueObjectHelper()
            if GlobalOptions.rtl and not GlobalOptions.skipverify:
                if self.purpose == "LIF_QUEUE_PURPOSE_RX":
                    # Ring the doorbell, don't increment the PI and don't set
                    # the scheduler bit.
                    # The PI will be incremented by directly writing to QState.
                    self.upd = 0x0
                elif self.purpose == "LIF_QUEUE_PURPOSE_TX":
                    # Ring the doorbell, don't increment the PI and but set
                    # the scheduler bit.
                    # The PI will be incremented by directly writing to QState.
                    self.upd = 0x1
                else:
                    self.upd = 0x0
            else:
                if self.purpose == "LIF_QUEUE_PURPOSE_RX":
                    # Ring the doorbell, set PI=index and the scheduler bit.
                    self.upd = 0x9
                elif self.purpose == "LIF_QUEUE_PURPOSE_TX":
                    # Ring the doorbell, set PI=index and the scheduler bit.
                    self.upd = 0x9
                else:
                    self.upd = 0x0
            self.doorbell = doorbell.Doorbell()
            self.doorbell.Init(self, self.spec)
        elif spec.id in rdma_queue_type_ids:
            self.obj_helper_q = rdma_queue.RdmaQueueObjectHelper()
        elif spec.id in nvme_queue_type_ids:
            logger.info("nvme queue type %s" %(self.id))
            self.obj_helper_q = nvme_queue.NvmeQueueObjectHelper()
        else:
            self.need_type_specific_configure = False
            return

        self.obj_helper_q.Generate(self, spec)
        if len(self.obj_helper_q.queues) > 0:
            self.queues.SetAll(self.obj_helper_q.queues)

        self.Show()
Exemplo n.º 7
0
    def Init(self, queue_type, spec):
        self.spec = spec
        self.queue_type = queue_type
        self.id = queue_type.GetQid()
        self.size = getattr(spec, 'size', 0)

        self.GID('Q%d' % self.id)

        self.rings = objects.ObjectDatabase()
        self.obj_helper_ring = ring.EthRingObjectHelper()
        self.obj_helper_ring.Generate(self, spec)
        self.rings.SetAll(self.obj_helper_ring.rings)

        self.Show()
Exemplo n.º 8
0
    def Init(self, queue_type, spec):
        self.queue_type = queue_type
        self.id = queue_type.GetQid()
        # Start qid numbering from 1 for adminq, eq
        if queue_type.GID() == "RDMA_AQ":
            self.id = self.id + 1
        self.qp_e_psn   = 0      #Needed for rx multi QP scale tests to pick next psn
        self.GID(str(self.id))

        self.rings      = objects.ObjectDatabase()
        self.obj_helper_ring = ring.RdmaRingObjectHelper()
        self.obj_helper_ring.Generate(self, spec)
        self.rings.SetAll(self.obj_helper_ring.rings)

        self.Show()
Exemplo n.º 9
0
 def CreatePds(self, spec):
     self.pds = objects.ObjectDatabase()
     self.obj_helper_pd = pd.PdObjectHelper()
     self.obj_helper_pd.Generate(self, spec)
     self.pds.SetAll(self.obj_helper_pd.pds)
     logger.debug("In CreatePds, Endpoint %s" % (self.GID()))
     for eppd in self.obj_helper_pd.pds:
         logger.debug("   Adding QPs for PD %s, Num of Qps %d" %
                      (eppd.GID(), len(eppd.udqps)))
         pdudqps = eppd.udqps.GetAll()
         for qp in pdudqps:
             logger.debug("      Adding QP: PD %s, QP %s" %
                          (eppd.GID(), qp.GID()))
             self.udqps.append(qp)
     logger.debug("   Total UDQPs in this endpoint: Qps %d" %
                  (len(self.udqps)))
Exemplo n.º 10
0
 def Init(self, ifinfo, spec, namespace=None):
     self.id = namespace.get()
     self.GID("Lif%d" % self.id)
     self.spec = spec
     self.hw_lif_id = self.id
     self.devcmdaddr = ifinfo.DevcmdMemAddr
     self.qstate_base = ifinfo.Lif2QstateMap.get(self.hw_lif_id, {})
     self.queue_types = objects.ObjectDatabase()
     self.obj_helper_q = queue_type.QueueTypeObjectHelper()
     self.obj_helper_q.Generate(self, spec)
     self.queue_types.SetAll(self.obj_helper_q.queue_types)
     self.queue_types_list = self.obj_helper_q.queue_types
     self.queue_list = []
     for q_type in self.queue_types_list:
         for queue in q_type.queues.GetAll():
             self.queue_list.append(queue)
     self.Show()
Exemplo n.º 11
0
    def Init(self, segment, spec):
        self.id = resmgr.MulticastGroupIdAllocator.get()
        self.GID("McGroup%04d" % self.id)

        self.type = spec.type.upper()
        self.config = getattr(spec, 'config', True)
        self.group = spec.group.get()
        self.source = spec.source.get()
        self.l3type = spec.l3type.upper()
        self.gip = spec.gip.get()
        self.segment = segment
        self.pinnedif = segment.pinnedif

        self.session_spec = spec.session

        self.oifs = objects.ObjectDatabase()
        self.enic_list = []
        self.uplink_list = []
        return
Exemplo n.º 12
0
    def Init(self, lif, spec):
        self.GID(spec.id)
        self.lif = lif
        self.spec = spec
        self.id = spec.id
        self.type = spec.type
        self.purpose = spec.purpose.upper()
        self.size = spec.size
        self.count = spec.count
        self.entries = None

        self.queueid_allocator = objects.TemplateFieldObject("range/0/16384")

        self.queues = objects.ObjectDatabase()
        self.need_type_specific_configure = True
        if spec.id in eth_queue_type_ids:
            self.obj_helper_q = eth_queue.EthQueueObjectHelper()
            if self.purpose == "LIF_QUEUE_PURPOSE_RX":
                # Ring the doorbell, set PI=index and the scheduler bit.
                self.upd = 0x9
            elif self.purpose == "LIF_QUEUE_PURPOSE_TX":
                # Ring the doorbell, set PI=index and the scheduler bit.
                self.upd = 0x9
            else:
                self.upd = 0x0
            self.doorbell = doorbell.Doorbell()
            self.doorbell.Init(self, self.spec)
        else:
            self.need_type_specific_configure = False
            return

        self.obj_helper_q.Generate(self, spec)
        if len(self.obj_helper_q.queues) > 0:
            self.queues.SetAll(self.obj_helper_q.queues)

        self.Show()
Exemplo n.º 13
0
#! /usr/bin/python3

import infra.common.parser as parser
import infra.common.objects as objects
import pdb

from infra.common.logging import logger
from infra.common.glopts import GlobalOptions
from infra.engine.modmgr import ModuleStore

FeatureStore = objects.ObjectDatabase()
BaseTopoExcludeFeatureList = [
    'dolut',
    'fte',
    'fte2',
    'ftevxlan',
    'norm',
    'eth',
    'acl',
    'networking',
    'config',
    'vxlan',
    'ipsg',
    'firewall',
    'proxy',
    'ipsec',
    'hostpin',
    'multicast',
    'l4lb',
    'recirc',
    'admin',
Exemplo n.º 14
0
 def __init__(self):
     self.connections = objects.ObjectDatabase()
     self.steps = objects.ObjectDatabase()
     self.testcases = objects.ObjectDatabase()
     self.trackers = objects.ObjectDatabase()
     return
Exemplo n.º 15
0
    def __init__(self, ep, spec, pd_id):
        super().__init__()
        self.ep = ep
        self.id = pd_id
        self.GID("PD%04d" % self.id)
        self.spec = spec
        self.remote = ep.remote
        self.mws_type_1 = []
        self.mws_type_2 = []
        self.mws_type_1_2 = []
        self.total_type_1_mws = 0
        self.total_type_2_mws = 0
        self.total_type_1_2_mws = 0
        self.last_type1_mw_id = -1
        self.last_type2_mw_id = -1
        self.last_type1_2_mw_id = -1
        self.last_key_id = 0

        if not self.remote:
            self.ep.intf.lif.RegisterPd(self)

        #MRs
        self.mrs = objects.ObjectDatabase()
        self.obj_helper_mr = mr.MrObjectHelper()
        mr_spec = spec.mr.Get(Store)
        self.obj_helper_mr.Generate(self, mr_spec)
        if len(self.obj_helper_mr.mrs):
            self.mrs.SetAll(self.obj_helper_mr.mrs)

        #QPs
        self.qps = objects.ObjectDatabase()
        self.perf_qps = objects.ObjectDatabase()
        self.dcqcn_qps = objects.ObjectDatabase()
        self.udqps = objects.ObjectDatabase()
        self.obj_helper_qp = qp.QpObjectHelper()
        qp_spec = spec.qp.Get(Store)
        self.obj_helper_qp.Generate(self, qp_spec)
        if len(self.obj_helper_qp.qps):
            self.qps.SetAll(self.obj_helper_qp.qps)
        if len(self.obj_helper_qp.perf_qps):
            self.perf_qps.SetAll(self.obj_helper_qp.perf_qps)
        if len(self.obj_helper_qp.dcqcn_qps):
            self.dcqcn_qps.SetAll(self.obj_helper_qp.dcqcn_qps)
        if len(self.obj_helper_qp.udqps):
            self.udqps.SetAll(self.obj_helper_qp.udqps)
        logger.info('PD: %s Total UdQps in the PD : %d ' %
                    (self.GID(), len(self.udqps)))
        #pdudqps = self.udqps.GetAll()
        #for tmpqp in pdudqps:
        #    logger.info('   Qps: %s' % (tmpqp.GID()))

        #MWs
        self.mws = objects.ObjectDatabase()
        self.obj_helper_mw = mw.MwObjectHelper()
        mw_spec = spec.mw.Get(Store)
        self.obj_helper_mw.Generate(self, mw_spec)
        if len(self.obj_helper_mw.mws):
            self.mws.SetAll(self.obj_helper_mw.mws)

        #Keys
        self.keys = objects.ObjectDatabase()
        self.obj_helper_key = key.KeyObjectHelper()
        key_spec = spec.key.Get(Store)
        self.obj_helper_key.Generate(self, key_spec)
        if len(self.obj_helper_key.keys):
            self.keys.SetAll(self.obj_helper_key.keys)

        self.Show()
        return
Exemplo n.º 16
0
    def Init(self, tenant, spec, namespace=None):
        if namespace:
            self.id = namespace.get()
        else:
            self.id = resmgr.LifIdAllocator.get()
        self.GID("Lif%d" % self.id)
        self.status = haldefs.interface.IF_STATUS_UP
        self.hw_lif_id = -1
        self.qstate_base = {}
        self.promiscuous = False
        self.allmulticast = False
        self.pds = []

        self.c_lib_name = getattr(spec, 'c_lib', None)
        if self.c_lib_name:
            self.c_lib = clibs.LoadCLib(self.c_lib_name)
            if self.c_lib:
                self.c_lib_config = self.c_lib[self.c_lib_name + '_config']
                self.c_lib_config.argtypes = [ctypes.POINTER(QInfoStruct)]
                self.c_lib_config.restype = None
        else:
            self.c_lib = None

        if hasattr(spec, 'rdma') and spec.rdma.enable:
            self.enable_rdma = spec.rdma.enable
            self.rdma_max_pt_entries = spec.rdma.max_pt_entries
            self.rdma_max_keys = spec.rdma.max_keys
            self.rdma_max_ahs = spec.rdma.max_ahs
            self.hostmem_pg_size = spec.rdma.hostmem_pg_size
            self.hbm_barmap_entries = (int(spec.rdma.hbm_barmap_size /
                                           spec.rdma.hostmem_pg_size))
            self.rdma_tbl_pos = BitArray(length=self.rdma_max_pt_entries)
            self.hbm_tbl_pos = BitArray(length=self.hbm_barmap_entries)
            self.rdma_async_eq_id = 0
            self.rdma_admin_aq_id = 1
            self.rdma_admin_cq_id = 0
        else:
            self.enable_rdma = False
            self.rdma_max_pt_entries = 0
            self.rdma_max_keys = 0
            self.rdma_max_ahs = 0
            self.hbm_barmap_entries = 0
            self.hostmem_pg_size = 0
        self.rdma_pt_base_addr = 0
        self.rdma_kt_base_addr = 0
        self.rdma_dcqcn_profile_base_addr = 0
        self.rdma_at_base_addr = 0

        if hasattr(spec, 'nvme') and spec.nvme.enable:
            self.enable_nvme = spec.nvme.enable
            self.nvme_lif = nvme_lif.NvmeLifObject(self, spec.nvme)
        else:
            self.enable_nvme = False

        self.vlan_strip_en = False
        self.vlan_insert_en = False

        self.queue_types = objects.ObjectDatabase()
        self.obj_helper_q = queue_type.QueueTypeObjectHelper()
        self.obj_helper_q.Generate(self, spec)
        self.queue_types.SetAll(self.obj_helper_q.queue_types)
        self.queue_types_list = self.obj_helper_q.queue_types
        self.queue_list = []
        for q_type in self.queue_types_list:
            for queue in q_type.queues.GetAll():
                self.queue_list.append(queue)

        # RDMA per LIF allocators
        if self.enable_rdma:
            # QP 0, 1 are special QPs
            self.qpid_allocator = objects.TemplateFieldObject(
                "range/2/" + str(spec.rdma.max_qp))
            # AQ ID 0 is owned by ETH
            self.aqid_allocator = objects.TemplateFieldObject(
                "range/1/" + str(spec.rdma.max_aq))
            # Reserve CQ 0, 1 for special QPs, AQ
            self.cqid_allocator = objects.TemplateFieldObject(
                "range/2/" + str(spec.rdma.max_cq))
            self.eqid_allocator = objects.TemplateFieldObject(
                "range/0/" + str(spec.rdma.max_eq))
            self.pd_allocator = objects.TemplateFieldObject(
                "range/0/" + str(spec.rdma.max_pd))
            self.mr_key_allocator = objects.TemplateFieldObject(
                "range/1/" + str(spec.rdma.max_mr))
            self.slab_allocator = objects.TemplateFieldObject("range/0/2048")
            self.kslab_allocator = objects.TemplateFieldObject("range/0/2048")

            # Generate RDMA LIF owned resources
            self.slabs = objects.ObjectDatabase()

            # Generate KernelSlab of 4KB and 10 MB for FRPMR
            self.kslab_4KB = slab.SlabObject(self, 4096, True)

            self.obj_helper_slab = slab.SlabObjectHelper()
            #slab_spec = spec.rdma.slab.Get(Store)
            #self.obj_helper_slab.Generate(self, slab_spec)
            #self.slabs.SetAll(self.obj_helper_slab.slabs)

            # Create EQs for RDMA LIF
            self.eqs = objects.ObjectDatabase()
            self.obj_helper_eq = eq.EqObjectHelper()
            self.obj_helper_eq.Generate(self, spec.rdma.max_eq,
                                        spec.rdma.max_eqe)
            if len(self.obj_helper_eq.eqs):
                self.eqs.SetAll(self.obj_helper_eq.eqs)

            # Create CQ 0 for adminQ
            logger.info("Creating 1 Cqs. for LIF:%s" % (self.GID()))
            # Hardcode CQ 0 for AQ
            # Page size is calculated as max_cqe * cqe_size by the CQ for privileged resources
            cq_id = 0
            self.cq = cqs.CqObject(None, cq_id, spec.rdma.max_cqe, 0, True,
                                   self)

            # Create AdminQ
            logger.info("Creating 1 Aqs. for LIF:%s" % (self.GID()))
            aq_id = self.GetAqid()
            self.aq = aqs.AqObject(self, aq_id, spec.rdma.max_aqe,
                                   spec.rdma.hostmem_pg_size)

            self.dcqcn_config_spec = spec.rdma.dcqcn_config.Get(Store)

        if hasattr(spec, 'rss'):
            self.rss_type = (
                haldefs.interface.LifRssType.Value("RSS_TYPE_IPV4")
                | haldefs.interface.LifRssType.Value("RSS_TYPE_IPV4_TCP")
                | haldefs.interface.LifRssType.Value("RSS_TYPE_IPV4_UDP")
                | haldefs.interface.LifRssType.Value("RSS_TYPE_IPV6")
                | haldefs.interface.LifRssType.Value("RSS_TYPE_IPV6_TCP")
                | haldefs.interface.LifRssType.Value("RSS_TYPE_IPV6_UDP"))
            self.rss_key = array.array('B', toeplitz.toeplitz_msft_key)
            self.rss_indir = array.array('B', [0] * 128)
        else:
            self.rss_type = haldefs.interface.LifRssType.Value("RSS_TYPE_NONE")
            self.rss_key = array.array('B', toeplitz.toeplitz_msft_key)
            self.rss_indir = array.array('B', [0] * 128)

        self.tenant = tenant
        self.spec = spec

        self.tx_qos_class = None
        self.rx_qos_class = None
        if self.tenant.IsQosEnabled():
            self.tx_qos_class = getattr(spec, 'tx_qos_class', None)
            self.rx_qos_class = getattr(spec, 'rx_qos_class', None)
            if self.tx_qos_class:
                self.tx_qos_class = Store.objects.Get(self.tx_qos_class)
            if self.rx_qos_class:
                self.rx_qos_class = Store.objects.Get(self.rx_qos_class)

        self.Show()