[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.
This commit is contained in:
dflynn-Nokia 2021-01-12 19:59:42 -05:00 committed by GitHub
parent 380edf054d
commit 674fac21c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

View File

@ -3,3 +3,5 @@ nokia-7215_plt_setup.sh usr/sbin
7215/service/nokia-7215init.service etc/systemd/system
7215/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0
7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0
entropy.py etc/
inband_mgmt.sh etc/

View File

@ -0,0 +1,19 @@
#!/usr/bin/python
import fcntl, struct
import time
from os import path
RNDADDENTROPY=0x40085203
def avail():
with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail:
return int(avail.read())
if path.exists("/proc/sys/kernel/random/entropy_avail"):
while 1:
while avail() < 2048:
with open('/dev/urandom', 'rb') as urnd, open("/dev/random", mode='wb') as rnd:
d = urnd.read(512)
t = struct.pack('ii', 4 * len(d), len(d)) + d
fcntl.ioctl(rnd, RNDADDENTROPY, t)
time.sleep(30)

View File

@ -0,0 +1,28 @@
#!/bin/sh
#inband_mgmt
inband_mgmt(){
# In this platform, one of the network ports is used as mgmt interface.
# This script periodically monitors inband management port eth0 and
# assigns IP address to eth0 if needed.
if [ ! -f /host/machine.conf ]; then
exit 0
fi
#wait for n/w port init to complete
sleep 60
while :; do
ip -br link show eth0 2> /dev/null
if [ $? -eq 0 ]; then
ip address show eth0 | grep -qw "inet" 2>/dev/null
if [ $? -ne 0 ]; then
ifconfig eth0 down
systemctl restart networking
fi
sleep 120
else
sleep 3
fi
done
}
(inband_mgmt > /dev/null)&

View File

@ -30,6 +30,9 @@ main()
{
fw_uboot_env_cfg
echo "Nokia-IXS7215: /dev/mtd0 FW_ENV_DEFAULT"
python /etc/entropy.py &
/bin/sh /etc/inband_mgmt.sh
}
main $@