Skip to content
This repository was archived by the owner on Aug 18, 2024. It is now read-only.

Commit 1e7c980

Browse files
committed
first commit
0 parents  commit 1e7c980

File tree

3 files changed

+561
-0
lines changed

3 files changed

+561
-0
lines changed

Containerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM registry.redhat.io/rhel9/support-tools:latest
2+
WORKDIR /
3+
USER root
4+
RUN dnf install -y git python3 python3-pip && \
5+
git clone --depth=1 https://github.com/torvalds/linux.git && \
6+
pip install -r /linux/tools/net/ynl/requirements.txt && \
7+
dnf remove -y git
8+
# Comment out this line when dpll.yaml will be upstream
9+
COPY dpll.yaml /linux/Documentation/netlink/specs/dpll.yaml
10+
11+
WORKDIR /linux/tools/net/ynl
12+
13+
# Uncomment this line if you want cli to block while waiting on netlink notifications
14+
RUN sed -i 's/, socket.MSG_DONTWAIT//g' lib/ynl.py
15+
16+
17+

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Netlink DPLL test container #
2+
3+
This repo helps to build a container image for netlink DPLL debug
4+
5+
## Bulid ##
6+
7+
```bash
8+
export IMG='quay.io/vgrinber/tools:dpll'
9+
```
10+
(replace with your repository)
11+
12+
```bash
13+
podman build -t $IMG -f Containerfile . && podman push $IMG
14+
```
15+
16+
## Hack ##
17+
The [Containerfile](Containerfile) specifies two hacks done to the kernel tools here:
18+
19+
### 1. Add DPLL YNL spec
20+
21+
```
22+
# Comment out this line when dpll.yaml will be upstream
23+
COPY dpll.yaml /linux/Documentation/netlink/specs/dpll.yaml
24+
```
25+
26+
### 2. Make monitoring call blocking
27+
28+
The upstream implementation of `ynl.py` opens the monitoring socket in non-blocking mode, which means that if there is no notification at the exact same moment you run the cli, it will exit.
29+
If we want to wait for notifications, this hack must be done:
30+
31+
```
32+
# Uncomment this line if you want cli to block while waiting on netlink notifications
33+
RUN sed -i 's/, socket.MSG_DONTWAIT//g' lib/ynl.py
34+
```
35+
36+
## Use ##
37+
38+
```bash
39+
oc debug no/cnfde21.ptp.lab.eng.bos.redhat.com --image=quay.io/vgrinber/tools@sha256:b0b36d8f6fc7a8bb2d6e6eb7831061da3711ddbce422e4856df143a5b948011d
40+
Starting pod/cnfde21ptplabengbosredhatcom-debug-tl8hl ...
41+
To use host binaries, run `chroot /host`
42+
Pod IP: 10.16.230.5
43+
If you don't see a command prompt, try pressing enter.
44+
45+
sh-5.1# python3 cli.py --spec /linux/Documentation/netlink/specs/dpll.yaml --dump device-get
46+
[{'clock-id': 5799633565433967664,
47+
'id': 0,
48+
'lock-status': 'locked-ho-acq',
49+
'mode': 'automatic',
50+
'mode-supported': ['automatic'],
51+
'module-name': 'ice',
52+
'type': 'eec'},
53+
{'clock-id': 5799633565433967664,
54+
'id': 1,
55+
'lock-status': 'locked-ho-acq',
56+
'mode': 'automatic',
57+
'mode-supported': ['automatic'],
58+
'module-name': 'ice',
59+
'type': 'pps'},
60+
{'clock-id': 5799633565433966964,
61+
'id': 2,
62+
'lock-status': 'unlocked',
63+
'mode': 'automatic',
64+
'mode-supported': ['automatic'],
65+
'module-name': 'ice',
66+
'type': 'eec'},
67+
{'clock-id': 5799633565433966964,
68+
'id': 3,
69+
'lock-status': 'unlocked',
70+
'mode': 'automatic',
71+
'mode-supported': ['automatic'],
72+
'module-name': 'ice',
73+
'type': 'pps'}]
74+
75+
sh-5.1# python3 cli.py --spec /linux/Documentation/netlink/specs/dpll.yaml --subscribe monitor
76+
77+
```
78+
The last command above will block waiting for a notification.

0 commit comments

Comments
 (0)