Skip to content

Commit b620458

Browse files
Merge branch 'main' into pr1234
Resolved conflicts: tests/validation/configs/test_config.yaml tests/validation/conftest.py tests/validation/tests/single/st20p/resolutions/test_resolutions.py tests/validation/tests/single/st22p/format/test_format.py tests/validation/tests/single/st30p/st30p_format/test_st30p_format.py tests/validation/tests/single/st41/payload_type/test_payload_type.py
2 parents 91ca769 + 9168009 commit b620458

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+988
-428
lines changed

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ jobs:
7272

7373
# Upload the results to GitHub's code scanning dashboard.
7474
- name: "Upload to code-scanning"
75-
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
75+
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
7676
with:
7777
sarif_file: results.sarif

.github/workflows/smoke-tests.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: smoke-tests-bare-metal
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- 'maint-**'
8+
pull_request:
9+
branches:
10+
- main
11+
- 'maint-**'
12+
env:
13+
BUILD_TYPE: 'Release'
14+
DPDK_VERSION: '25.03'
15+
DPDK_REBUILD: 'false'
16+
permissions:
17+
contents: read
18+
jobs:
19+
validation-build-mtl:
20+
runs-on: [Linux, self-hosted, DPDK]
21+
timeout-minutes: 60
22+
outputs:
23+
pipenv-activate: ${{ steps.pipenv-install.outputs.VIRTUAL_ENV }}
24+
steps:
25+
- name: 'preparation: Harden Runner'
26+
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
27+
with:
28+
egress-policy: audit
29+
- name: 'preparation: Restore valid repository owner and print env'
30+
if: always()
31+
run: |
32+
sudo chown -R "${USER}" "$(pwd)" || true
33+
env | grep TEST_ || true
34+
- name: 'preparation: Checkout MTL'
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36+
with:
37+
ref: '${{ github.ref }}'
38+
- name: 'preparation: Checkout DPDK'
39+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
if: env.DPDK_REBUILD == 'true'
41+
with:
42+
repository: 'DPDK/dpdk'
43+
ref: 'v${{ env.DPDK_VERSION }}'
44+
path: 'dpdk'
45+
- name: 'preparation: Checkout openh264'
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
with:
48+
repository: 'cisco/openh264'
49+
ref: 'openh264v2.4.0'
50+
path: 'openh264'
51+
- name: 'preparation: Checkout FFmpeg'
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
53+
with:
54+
repository: 'FFmpeg/FFmpeg'
55+
ref: 'release/7.0'
56+
path: 'ffmpeg'
57+
- name: 'configuration: Install the build dependency'
58+
run: |
59+
sudo apt update
60+
sudo apt-get remove -y pipenv || true
61+
sudo apt-get install -y \
62+
git gcc meson tar zip \
63+
pkg-config \
64+
python3 \
65+
python3-pyelftools \
66+
python3-virtualenv \
67+
python3-pip \
68+
libnuma-dev \
69+
libjson-c-dev \
70+
libpcap-dev \
71+
libgtest-dev \
72+
libsdl2-dev \
73+
libsdl2-ttf-dev \
74+
libssl-dev \
75+
systemtap-sdt-dev \
76+
libbpf-dev \
77+
libelf1 \
78+
gstreamer1.0-plugins-base \
79+
gstreamer1.0-plugins-good \
80+
gstreamer1.0-tools \
81+
gstreamer1.0-libav \
82+
libgstreamer1.0-dev \
83+
libgstreamer-plugins-base1.0-dev
84+
- name: 'configuration: Apply dpdk patches'
85+
if: env.DPDK_REBUILD == 'true'
86+
run: |
87+
patch -d "dpdk" -p1 -i <(cat patches/dpdk/${{ env.DPDK_VERSION }}/*.patch)
88+
- name: 'installation: Build dpdk'
89+
working-directory: dpdk
90+
if: env.DPDK_REBUILD == 'true'
91+
run: |
92+
meson build
93+
ninja -C build
94+
sudo ninja -C build install
95+
- name: 'installation: Build mtl'
96+
run: |
97+
./build.sh
98+
sudo ldconfig
99+
- name: 'installation: Build openh264'
100+
working-directory: openh264
101+
run: |
102+
make -j "$(nproc)"
103+
sudo make install
104+
sudo ldconfig
105+
- name: 'installation: Build FFmpeg'
106+
working-directory: ffmpeg
107+
run: |
108+
git am ../ecosystem/ffmpeg_plugin/7.0/*.patch
109+
cp ../ecosystem/ffmpeg_plugin/mtl_*.c -rf libavdevice/
110+
cp ../ecosystem/ffmpeg_plugin/mtl_*.h -rf libavdevice/
111+
./configure --enable-shared --disable-static --enable-nonfree --enable-pic --enable-gpl --enable-libopenh264 --enable-encoder=libopenh264 --enable-mtl
112+
make -j "$(nproc)"
113+
sudo make install
114+
sudo ldconfig
115+
- name: 'installation: Build GStreamer'
116+
working-directory: ecosystem/gstreamer_plugin
117+
run: |
118+
./build.sh
119+
- name: 'installation: Install pipenv environment'
120+
working-directory: tests/validation
121+
id: pipenv-install
122+
run: |
123+
python3 -m venv venv
124+
source venv/bin/activate
125+
pip install -r requirements.txt
126+
echo "VIRTUAL_ENV=$PWD/venv/bin/activate" >> "$GITHUB_ENV"
127+
validation-run-tests:
128+
needs: [validation-build-mtl]
129+
runs-on: [Linux, self-hosted, DPDK]
130+
timeout-minutes: 720
131+
env:
132+
PYTEST_RETRIES: '3'
133+
steps:
134+
- name: 'preparation: Harden Runner'
135+
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
136+
with:
137+
egress-policy: audit
138+
- name: 'preparation: Evaluate choosen validation-test-port-p and validation-test-port-r'
139+
run: |
140+
eval "export TEST_PORT_P=TEST_VF_PORT_P_0"
141+
eval "export TEST_PORT_R=TEST_VF_PORT_P_1"
142+
echo "TEST_PORT_P=${TEST_PORT_P}" >> "$GITHUB_ENV"
143+
echo "TEST_PORT_R=${TEST_PORT_R}" >> "$GITHUB_ENV"
144+
echo "TEST_PORT_P=${TEST_PORT_P}"
145+
echo "TEST_PORT_R=${TEST_PORT_R}"
146+
- name: 'preparation: Kill MtlManager and pytest routines'
147+
run: |
148+
sudo killall -SIGINT pipenv || true
149+
sudo killall -SIGINT pytest || true
150+
sudo killall -SIGINT MtlManager || true
151+
- name: 'preparation: Create VFs'
152+
run: |
153+
sudo rmmod irdma || true
154+
sudo ./script/nicctl.sh create_vf "${TEST_PF_PORT_P}" || true
155+
sudo ./script/nicctl.sh create_vf "${TEST_PF_PORT_R}" || true
156+
- name: 'preparation: Start MtlManager at background'
157+
run: |
158+
sudo MtlManager &
159+
- name: 'execution: Run validation-bare-metal tests in virtual environment'
160+
run: |
161+
sudo tests/validation/venv/bin/python3 -m pytest --topology_config=tests/validation/configs/topology_config.yaml --test_config=tests/validation/configs/test_config.yaml -m smoke --template=html/index.html --report=report.html
162+
- name: "upload report"
163+
id: upload-report
164+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
165+
with:
166+
name: smoke-tests-report
167+
path: |
168+
report.html
169+
- name: "Add report to summary"
170+
if: always()
171+
run: |
172+
{
173+
echo "## Smoke Tests Report"
174+
echo ""
175+
# Check if JSON report exists
176+
if [ -f "report.json" ]; then
177+
# Parse JSON report
178+
PASSED=$(jq '.summary.passed // 0' report.json)
179+
FAILED=$(jq '.summary.failed // 0' report.json)
180+
SKIPPED=$(jq '.summary.skipped // 0' report.json)
181+
ERROR=$(jq '.summary.errors // 0' report.json)
182+
# Add summary stats
183+
echo "| Status | Count |"
184+
echo "| ------ | ----- |"
185+
echo "| ✅ Passed | ${PASSED:-0} |"
186+
echo "| ❌ Failed | ${FAILED:-0} |"
187+
echo "| ⚠️ Error | ${ERROR:-0} |"
188+
echo "| ⏭️ Skipped | ${SKIPPED:-0} |"
189+
echo ""
190+
# Add test result details if available
191+
TOTAL=$((${PASSED:-0} + ${FAILED:-0} + ${ERROR:-0} + ${SKIPPED:-0}))
192+
echo "**Total Tests:** $TOTAL"
193+
echo ""
194+
if [ "${FAILED:-0}" -gt 0 ] || [ "${ERROR:-0}" -gt 0 ]; then
195+
echo "❌ **Some tests failed!** Please check the detailed report."
196+
else
197+
echo "✅ **All tests passed!**"
198+
fi
199+
echo ""
200+
# Add link to full report artifact
201+
echo "📄 [Download Full HTML Report](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts/${{ steps.upload-report.outputs.artifact-id }})"
202+
else
203+
echo "❌ No report.json file was generated"
204+
fi
205+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/trivy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454

5555
- name: Run Trivy vulnerability scanner with sarif output
56-
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
56+
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
5757
with:
5858
scan-type: config
5959
scan-ref: ./docker
@@ -63,7 +63,7 @@ jobs:
6363
output: Trivy-dockerfile.sarif
6464

6565
- name: Upload Trivy scan results to GitHub Security tab
66-
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
66+
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
6767
with:
6868
sarif_file: Trivy-dockerfile.sarif
6969

@@ -91,7 +91,7 @@ jobs:
9191
ref: ${{ inputs.branch }}
9292

9393
- name: Run Trivy vulnerability scanner with sarif output
94-
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
94+
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
9595
with:
9696
scan-type: config
9797
scan-ref: ./manager
@@ -101,7 +101,7 @@ jobs:
101101
output: Trivy-manager-dockerfile.sarif
102102

103103
- name: Upload Trivy scan results to GitHub Security tab
104-
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
104+
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
105105
with:
106106
sarif_file: Trivy-manager-dockerfile.sarif
107107

@@ -127,7 +127,7 @@ jobs:
127127
ref: ${{ inputs.branch }}
128128

129129
- name: Run Trivy vulnerability scanner with table output
130-
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
130+
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
131131
with:
132132
scan-type: config
133133
scan-ref: ./docker
@@ -137,7 +137,7 @@ jobs:
137137
vuln-type: os,library
138138

139139
- name: Run Trivy manager vulnerability scanner with table output
140-
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
140+
uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0
141141
with:
142142
scan-type: config
143143
scan-ref: ./manager

app/sample/ext_frame/rx_st20_pipeline_dyn_ext_frame_sample.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@ static int rx_st20p_query_ext_frame(void* priv, struct st_ext_frame* ext_frame,
4242
struct rx_st20p_sample_ctx* s = priv;
4343
int i = s->ext_idx;
4444
MTL_MAY_UNUSED(meta);
45-
4645
/* you can check the timestamp from lib by meta->timestamp */
4746

4847
ext_frame->addr[0] = s->ext_frames[i].buf_addr;
4948
ext_frame->iova[0] = s->ext_frames[i].buf_iova;
5049
ext_frame->size = s->ext_frames[i].buf_len;
5150

51+
uint8_t* addr = ext_frame->addr[0];
52+
uint8_t planes = st_frame_fmt_planes(meta->fmt);
53+
for (int plane = 0; plane < planes; plane++) {
54+
if (plane > 0)
55+
ext_frame->iova[plane] =
56+
ext_frame->iova[plane - 1] + ext_frame->linesize[plane - 1] * meta->height;
57+
ext_frame->linesize[plane] = st_frame_least_linesize(meta->fmt, meta->width, plane);
58+
ext_frame->addr[plane] = addr;
59+
addr += ext_frame->linesize[plane] * meta->height;
60+
}
61+
5262
/* save your private data here get it from st_frame.opaque */
5363
/* ext_frame->opaque = ?; */
5464

@@ -150,6 +160,15 @@ int main(int argc, char** argv) {
150160
ret = rx_sample_parse_args(&ctx, argc, argv);
151161
if (ret < 0) return ret;
152162

163+
bool is_output_yuv420 = ctx.output_fmt == ST_FRAME_FMT_YUV420CUSTOM8 ||
164+
ctx.output_fmt == ST_FRAME_FMT_YUV420PLANAR8;
165+
if (ctx.ext_frame && is_output_yuv420) {
166+
warn(
167+
"%s: external frame mode does not support yuv420 output format, use other format "
168+
"e.g. yuv422\n",
169+
__func__);
170+
}
171+
153172
/* enable auto start/stop */
154173
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
155174
ctx.st = mtl_init(&ctx.param);
@@ -199,12 +218,13 @@ int main(int argc, char** argv) {
199218
ops_rx.framebuff_cnt = app[i]->fb_cnt;
200219
ops_rx.notify_frame_available = rx_st20p_frame_available;
201220

202-
if (equal) {
203-
/* no convert, use ext frame for example */
221+
if (equal || ctx.ext_frame) {
222+
/* pre-allocate ext frames */
204223
app[i]->ext_frames =
205224
(struct st20_ext_frame*)malloc(sizeof(*app[i]->ext_frames) * app[i]->fb_cnt);
206-
size_t framebuff_size =
207-
st20_frame_size(ops_rx.transport_fmt, ops_rx.width, ops_rx.height);
225+
size_t framebuff_size = st_frame_size(ops_rx.output_fmt, ops_rx.width,
226+
ops_rx.height, ops_rx.interlaced);
227+
208228
size_t fb_size = framebuff_size * app[i]->fb_cnt;
209229
/* alloc enough memory to hold framebuffers and map to iova */
210230
mtl_dma_mem_handle dma_mem = mtl_dma_mem_alloc(ctx.st, fb_size);
@@ -225,6 +245,7 @@ int main(int argc, char** argv) {
225245
/* use dynamic external frames */
226246
ops_rx.query_ext_frame = rx_st20p_query_ext_frame;
227247
ops_rx.flags |= ST20P_RX_FLAG_RECEIVE_INCOMPLETE_FRAME;
248+
ops_rx.flags |= ST20P_RX_FLAG_EXT_FRAME;
228249
}
229250

230251
st20p_rx_handle rx_handle = st20p_rx_create(ctx.st, &ops_rx);

app/src/app_platform.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ static inline void st_usleep(
162162
#endif
163163
}
164164

165-
static inline int st_get_real_time(struct timespec* ts) {
166-
return clock_gettime(CLOCK_REALTIME, ts);
165+
static inline int st_get_tai_time(struct timespec* ts) {
166+
return clock_gettime(CLOCK_TAI, ts);
167167
}
168168

169-
static inline int st_set_real_time(struct timespec* ts) {
170-
return clock_settime(CLOCK_REALTIME, ts);
169+
static inline int st_set_tai_time(struct timespec* ts) {
170+
return clock_settime(CLOCK_TAI, ts);
171171
}
172172

173173
#ifdef APP_HAS_SSL

lib/src/st2110/st_header.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,6 @@ struct st_tx_audio_session_pacing {
747747
uint64_t cur_epochs; /* epoch of current pkt */
748748
/* timestamp for rtp header */
749749
uint32_t rtp_time_stamp;
750-
/* timestamp for pacing */
751-
uint32_t pacing_time_stamp;
752750
uint64_t cur_epoch_time;
753751
/* in ns, tsc time cursor for packet pacing */
754752
uint64_t tsc_time_cursor;

0 commit comments

Comments
 (0)