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

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vitus133 committed Aug 31, 2023
0 parents commit 1e7c980
Show file tree
Hide file tree
Showing 3 changed files with 561 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM registry.redhat.io/rhel9/support-tools:latest
WORKDIR /
USER root
RUN dnf install -y git python3 python3-pip && \
git clone --depth=1 https://github.com/torvalds/linux.git && \
pip install -r /linux/tools/net/ynl/requirements.txt && \
dnf remove -y git
# Comment out this line when dpll.yaml will be upstream
COPY dpll.yaml /linux/Documentation/netlink/specs/dpll.yaml

WORKDIR /linux/tools/net/ynl

# Uncomment this line if you want cli to block while waiting on netlink notifications
RUN sed -i 's/, socket.MSG_DONTWAIT//g' lib/ynl.py



78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Netlink DPLL test container #

This repo helps to build a container image for netlink DPLL debug

## Bulid ##

```bash
export IMG='quay.io/vgrinber/tools:dpll'
```
(replace with your repository)

```bash
podman build -t $IMG -f Containerfile . && podman push $IMG
```

## Hack ##
The [Containerfile](Containerfile) specifies two hacks done to the kernel tools here:

### 1. Add DPLL YNL spec

```
# Comment out this line when dpll.yaml will be upstream
COPY dpll.yaml /linux/Documentation/netlink/specs/dpll.yaml
```

### 2. Make monitoring call blocking

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.
If we want to wait for notifications, this hack must be done:

```
# Uncomment this line if you want cli to block while waiting on netlink notifications
RUN sed -i 's/, socket.MSG_DONTWAIT//g' lib/ynl.py
```

## Use ##

```bash
oc debug no/cnfde21.ptp.lab.eng.bos.redhat.com --image=quay.io/vgrinber/tools@sha256:b0b36d8f6fc7a8bb2d6e6eb7831061da3711ddbce422e4856df143a5b948011d
Starting pod/cnfde21ptplabengbosredhatcom-debug-tl8hl ...
To use host binaries, run `chroot /host`
Pod IP: 10.16.230.5
If you don't see a command prompt, try pressing enter.
sh-5.1# python3 cli.py --spec /linux/Documentation/netlink/specs/dpll.yaml --dump device-get
[{'clock-id': 5799633565433967664,
'id': 0,
'lock-status': 'locked-ho-acq',
'mode': 'automatic',
'mode-supported': ['automatic'],
'module-name': 'ice',
'type': 'eec'},
{'clock-id': 5799633565433967664,
'id': 1,
'lock-status': 'locked-ho-acq',
'mode': 'automatic',
'mode-supported': ['automatic'],
'module-name': 'ice',
'type': 'pps'},
{'clock-id': 5799633565433966964,
'id': 2,
'lock-status': 'unlocked',
'mode': 'automatic',
'mode-supported': ['automatic'],
'module-name': 'ice',
'type': 'eec'},
{'clock-id': 5799633565433966964,
'id': 3,
'lock-status': 'unlocked',
'mode': 'automatic',
'mode-supported': ['automatic'],
'module-name': 'ice',
'type': 'pps'}]
sh-5.1# python3 cli.py --spec /linux/Documentation/netlink/specs/dpll.yaml --subscribe monitor
```
The last command above will block waiting for a notification.
Loading

0 comments on commit 1e7c980

Please sign in to comment.