Skip to content

Commit 533b7cc

Browse files
dflynn-Nokialguohan
authored andcommitted
[Nokia ixs7215] Add SW assist for platform entropy & fix inband mgmt support (#6417)
- Improve random number generation during early Sonic initialization by providing SW updates to Linux entropy value. - Improve handling of platform In-Band management port This commit provides the following updates to the Nokia ixs7215 platform 1. The Marvell Armada-38x SOC requires SW assistance to improve the system entropy value available early on in the Sonic boot sequence. 2. The Nokia ixs7215 platform does not have a dedicated Out-Of-Band (OOB) mgmt port and thus requires additional logic to optionally support configuring front panel port 48 as an In-Band mgmt port. This commit provides additional logic to manage and maintain the operation of this In-Band mgmt port.
1 parent d2f684b commit 533b7cc

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

platform/marvell-armhf/sonic-platform-nokia/debian/sonic-platform-nokia-7215.install

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ nokia-7215_plt_setup.sh usr/sbin
33
7215/service/nokia-7215init.service etc/systemd/system
44
7215/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0
55
7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0
6+
entropy.py etc/
7+
inband_mgmt.sh etc/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/python
2+
import fcntl, struct
3+
import time
4+
from os import path
5+
6+
RNDADDENTROPY=0x40085203
7+
8+
def avail():
9+
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
10+
return int(avail.read())
11+
12+
if path.exists("/proc/sys/kernel/random/entropy_avail"):
13+
while 1:
14+
while avail() < 2048:
15+
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
16+
d = urnd.read(512)
17+
t = struct.pack('ii', 4 * len(d), len(d)) + d
18+
fcntl.ioctl(rnd, RNDADDENTROPY, t)
19+
time.sleep(30)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
#inband_mgmt
4+
5+
inband_mgmt(){
6+
# In this platform, one of the network ports is used as mgmt interface.
7+
# This script periodically monitors inband management port eth0 and
8+
# assigns IP address to eth0 if needed.
9+
if [ ! -f /host/machine.conf ]; then
10+
exit 0
11+
fi
12+
#wait for n/w port init to complete
13+
sleep 60
14+
while :; do
15+
ip -br link show eth0 2> /dev/null
16+
if [ $? -eq 0 ]; then
17+
ip address show eth0 | grep -qw "inet" 2>/dev/null
18+
if [ $? -ne 0 ]; then
19+
ifconfig eth0 down
20+
systemctl restart networking
21+
fi
22+
sleep 120
23+
else
24+
sleep 3
25+
fi
26+
done
27+
}
28+
(inband_mgmt > /dev/null)&

platform/marvell-armhf/sonic-platform-nokia/nokia-7215_plt_setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ main()
3030
{
3131
fw_uboot_env_cfg
3232
echo "Nokia-IXS7215: /dev/mtd0 FW_ENV_DEFAULT"
33+
34+
python /etc/entropy.py &
35+
/bin/sh /etc/inband_mgmt.sh
3336
}
3437

3538
main $@

0 commit comments

Comments
 (0)