libnfb-ext-python 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: libnfb-ext-python
3
+ Version: 0.1.0
4
+ Author: Martin Spinler
5
+ Author-email: spinler@cesnet.cz
6
+ Requires-Dist: fdt
7
+ Dynamic: author
8
+ Dynamic: author-email
9
+ Dynamic: requires-dist
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: libnfb-ext-python
3
+ Version: 0.1.0
4
+ Author: Martin Spinler
5
+ Author-email: spinler@cesnet.cz
6
+ Requires-Dist: fdt
7
+ Dynamic: author
8
+ Dynamic: author-email
9
+ Dynamic: requires-dist
@@ -0,0 +1,10 @@
1
+ pyproject.toml
2
+ setup.py
3
+ libnfb_ext_python.egg-info/PKG-INFO
4
+ libnfb_ext_python.egg-info/SOURCES.txt
5
+ libnfb_ext_python.egg-info/dependency_links.txt
6
+ libnfb_ext_python.egg-info/requires.txt
7
+ libnfb_ext_python.egg-info/top_level.txt
8
+ nfb/ext/python/__init__.py
9
+ nfb/ext/python/ext_entry.c
10
+ nfb/ext/python/shim.c
@@ -0,0 +1,58 @@
1
+ "libnfb-ext for use in Python"
2
+
3
+ from abc import ABC, abstractmethod
4
+ import fdt
5
+
6
+ from . import shim
7
+
8
+
9
+ class AbstractNdpQueue(ABC):
10
+ def start(self):
11
+ pass
12
+
13
+ def stop(self):
14
+ pass
15
+
16
+
17
+ class AbstractNdpQueueRx(AbstractNdpQueue):
18
+ @abstractmethod
19
+ def burst_get(self, count):
20
+ pass
21
+
22
+ def burst_put(self):
23
+ pass
24
+
25
+
26
+ class AbstractNdpQueueTx(AbstractNdpQueue):
27
+ @abstractmethod
28
+ def burst_get(self, pkts):
29
+ pass
30
+
31
+ def burst_put(self):
32
+ pass
33
+
34
+ def burst_flush(self):
35
+ pass
36
+
37
+
38
+ class AbstractNfb(ABC):
39
+ def __init__(self, dtb):
40
+ self._nfb_ext_python_fdt = fdt.parse_dtb(dtb)
41
+ self._nfb_ext_python_dtb = dtb
42
+
43
+ def queue_open(self, index, dir, flags):
44
+ pass
45
+
46
+ def close(self):
47
+ pass
48
+
49
+ @abstractmethod
50
+ def read(self, bus_node, comp_node, offset, size):
51
+ return bytes([])
52
+
53
+ @abstractmethod
54
+ def write(self, bus_node, comp_node, offset, data):
55
+ return 0
56
+
57
+ def path(self):
58
+ return shim.get_libnfb_ext_path(self)
@@ -0,0 +1,28 @@
1
+ #include <libfdt.h>
2
+ #include <Python.h>
3
+
4
+ #include <nfb/nfb.h>
5
+ #include <nfb/ext.h>
6
+
7
+ #include <nfb/ndp.h>
8
+
9
+ #include "shim_api.h"
10
+
11
+ struct libnfb_ext_abi_version libnfb_ext_abi_version = libnfb_ext_abi_version_current;
12
+
13
+ int libnfb_ext_get_ops(const char *devname, struct libnfb_ext_ops *ops)
14
+ {
15
+ int ret;
16
+ PyGILState_STATE gstate = PyGILState_Ensure();
17
+
18
+ ret = import_shim();
19
+ if (ret) {
20
+ ret = -EBADFD;
21
+ goto out;
22
+ }
23
+
24
+ ret = pynfb_ext_get_ops(devname, ops);
25
+ out:
26
+ PyGILState_Release(gstate);
27
+ return ret;
28
+ }