Skip to content
Snippets Groups Projects
Commit 0163de03 authored by Martin Teichmann's avatar Martin Teichmann
Browse files

first time only read data

parent f00e3c6d
No related branches found
No related tags found
No related merge requests found
......@@ -215,7 +215,8 @@ class EBPFTerminal(Terminal):
bases = [None]
if self.pdo_out_sz:
bases.append(packet.size + packet.DATAGRAM_HEADER)
packet.append(ECCmd.FPWR, b"\0" * self.pdo_out_sz, 0,
packet.on_the_fly.append((packet.size, ECCmd.FPWR))
packet.append(ECCmd.NOP, b"\0" * self.pdo_out_sz, 0,
self.position, self.pdo_out_off)
return bases
......@@ -304,6 +305,7 @@ class SyncGroupBase:
def allocate(self):
self.packet = Packet()
self.packet.on_the_fly = []
self.terminals = {t: t.allocate(self.packet) for t in self.terminals}
......@@ -345,6 +347,8 @@ class FastSyncGroup(SyncGroupBase, XDP):
def program(self):
with self.packetSize >= self.packet.size + Packet.ETHERNET_HEADER as p:
for pos, cmd in self.packet.on_the_fly:
p.pB[pos + Packet.ETHERNET_HEADER] = cmd.value
for dev in self.devices:
dev.program()
self.exit(XDPExitCode.TX)
......
......@@ -75,11 +75,11 @@ class PacketArray:
self.no = no
self.memory = memory
def __getitem__(self, value):
return self.memory[self.ebpf.r[self.no] + value]
def __getitem__(self, pos):
return self.memory[self.ebpf.r[self.no] + pos]
def __setitem__(self, value):
self.memory[self.ebpf.r[self.no]] = value
def __setitem__(self, pos, value):
self.memory[self.ebpf.r[self.no] + pos] = value
class Packet:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment