aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/Memif.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2023-07-14 17:01:34 +0200
committerVratko Polak <vrpolak@cisco.com>2023-07-14 17:01:34 +0200
commitc461e9407dc7d10a27780e0140088ae0b1adf6e8 (patch)
tree6372aa0ac8a3c21a73e8a204bd6a342421e66de7 /resources/libraries/python/Memif.py
parentc1c75eaaba3d25309315ac27c8aa11b4d7834151 (diff)
feat(crc): bump messages for cycle after 2306
The supported VPP code is 380c62d7040bf285d449f1d05692141c40089470 which is the latest commit before stable/2306 diverged from master. + Separate messages into blocks with paths to .api sources. + Prepare memif for use_dma (currently always false). + Use srv6 test teardown action in srv6 device tests. - Do not use sr_policy_add_v2 from 37258 yet. - Leave a TODO to do it eventually, for now inputs are too different. - Do not use index based policer calls from 37873. - The policer_add_del is not deprecated yet and inputs are different. Change-Id: I350138f09542ec12ce4bec140203175940ccf9d4 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/Memif.py')
-rw-r--r--resources/libraries/python/Memif.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/resources/libraries/python/Memif.py b/resources/libraries/python/Memif.py
index d38f5000a7..4e0bb5fa4f 100644
--- a/resources/libraries/python/Memif.py
+++ b/resources/libraries/python/Memif.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -74,7 +74,7 @@ class Memif:
includes only retval.
:rtype: dict
"""
- cmd = u"memif_socket_filename_add_del"
+ cmd = u"memif_socket_filename_add_del_v2"
err_msg = f"Failed to create memif socket on host {node[u'host']}"
args = dict(
is_add=is_add,
@@ -85,7 +85,7 @@ class Memif:
return papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
- def _memif_create(node, mid, sid, rxq=1, txq=1, role=1):
+ def _memif_create(node, mid, sid, rxq=1, txq=1, role=1, use_dma=False):
"""Create Memif interface on the given node, return its sw_if_index.
:param node: Given node to create Memif interface on.
@@ -94,16 +94,18 @@ class Memif:
:param rxq: Number of RX queues; 0 means do not set.
:param txq: Number of TX queues; 0 means do not set.
:param role: Memif interface role [master=0|slave=1]. Default is slave.
+ :param use_dma: Use DMA acceleration. Requires hardware support.
:type node: dict
:type mid: str
:type sid: str
:type rxq: int
:type txq: int
:type role: int
+ :type use_dma: bool
:returns: sw_if_index
:rtype: int
"""
- cmd = u"memif_create"
+ cmd = u"memif_create_v2"
err_msg = f"Failed to create memif interface on host {node[u'host']}"
args = dict(
role=role,
@@ -111,7 +113,8 @@ class Memif:
tx_queues=int(txq),
socket_id=int(sid),
id=int(mid),
- secret=u""
+ secret=u"",
+ use_dma=use_dma,
)
with PapiSocketExecutor(node) as papi_exec:
@@ -119,7 +122,8 @@ class Memif:
@staticmethod
def create_memif_interface(
- node, filename, mid, sid, rxq=1, txq=1, role=u"SLAVE"):
+ node, filename, mid, sid, rxq=1, txq=1, role=u"SLAVE", use_dma=False
+ ):
"""Create Memif interface on the given node.
:param node: Given node to create Memif interface on.
@@ -129,6 +133,7 @@ class Memif:
:param rxq: Number of RX queues; 0 means do not set.
:param txq: Number of TX queues; 0 means do not set.
:param role: Memif interface role [master=0|slave=1]. Default is master.
+ :param use_dma: Use DMA acceleration. Requires hardware support.
:type node: dict
:type filename: str
:type mid: str
@@ -136,6 +141,7 @@ class Memif:
:type rxq: int
:type txq: int
:type role: str
+ :type use_dma: bool
:returns: SW interface index.
:rtype: int
:raises ValueError: If command 'create memif' fails.
@@ -147,7 +153,7 @@ class Memif:
# Create memif
sw_if_index = Memif._memif_create(
- node, mid, sid, rxq=rxq, txq=txq, role=role
+ node, mid, sid, rxq=rxq, txq=txq, role=role, use_dma=use_dma
)
# Update Topology