Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebpfCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Teichmann
ebpfCAT
Commits
0163de03
Commit
0163de03
authored
4 years ago
by
Martin Teichmann
Browse files
Options
Downloads
Patches
Plain Diff
first time only read data
parent
f00e3c6d
No related branches found
No related tags found
1 merge request
!3
Introduce watchdog
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ebpfcat/ebpfcat.py
+5
-1
5 additions, 1 deletion
ebpfcat/ebpfcat.py
ebpfcat/xdp.py
+4
-4
4 additions, 4 deletions
ebpfcat/xdp.py
with
9 additions
and
5 deletions
ebpfcat/ebpfcat.py
+
5
−
1
View file @
0163de03
...
@@ -215,7 +215,8 @@ class EBPFTerminal(Terminal):
...
@@ -215,7 +215,8 @@ class EBPFTerminal(Terminal):
bases
=
[
None
]
bases
=
[
None
]
if
self
.
pdo_out_sz
:
if
self
.
pdo_out_sz
:
bases
.
append
(
packet
.
size
+
packet
.
DATAGRAM_HEADER
)
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
)
self
.
position
,
self
.
pdo_out_off
)
return
bases
return
bases
...
@@ -304,6 +305,7 @@ class SyncGroupBase:
...
@@ -304,6 +305,7 @@ class SyncGroupBase:
def
allocate
(
self
):
def
allocate
(
self
):
self
.
packet
=
Packet
()
self
.
packet
=
Packet
()
self
.
packet
.
on_the_fly
=
[]
self
.
terminals
=
{
t
:
t
.
allocate
(
self
.
packet
)
for
t
in
self
.
terminals
}
self
.
terminals
=
{
t
:
t
.
allocate
(
self
.
packet
)
for
t
in
self
.
terminals
}
...
@@ -345,6 +347,8 @@ class FastSyncGroup(SyncGroupBase, XDP):
...
@@ -345,6 +347,8 @@ class FastSyncGroup(SyncGroupBase, XDP):
def
program
(
self
):
def
program
(
self
):
with
self
.
packetSize
>=
self
.
packet
.
size
+
Packet
.
ETHERNET_HEADER
as
p
:
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
:
for
dev
in
self
.
devices
:
dev
.
program
()
dev
.
program
()
self
.
exit
(
XDPExitCode
.
TX
)
self
.
exit
(
XDPExitCode
.
TX
)
...
...
This diff is collapsed.
Click to expand it.
ebpfcat/xdp.py
+
4
−
4
View file @
0163de03
...
@@ -75,11 +75,11 @@ class PacketArray:
...
@@ -75,11 +75,11 @@ class PacketArray:
self
.
no
=
no
self
.
no
=
no
self
.
memory
=
memory
self
.
memory
=
memory
def
__getitem__
(
self
,
value
):
def
__getitem__
(
self
,
pos
):
return
self
.
memory
[
self
.
ebpf
.
r
[
self
.
no
]
+
value
]
return
self
.
memory
[
self
.
ebpf
.
r
[
self
.
no
]
+
pos
]
def
__setitem__
(
self
,
value
):
def
__setitem__
(
self
,
pos
,
value
):
self
.
memory
[
self
.
ebpf
.
r
[
self
.
no
]]
=
value
self
.
memory
[
self
.
ebpf
.
r
[
self
.
no
]
+
pos
]
=
value
class
Packet
:
class
Packet
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment