2018-08-07 02:14:37 -05:00
|
|
|
#!/bin/bash
|
|
|
|
# This script load/unload opennsl kernel modules
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: load-opennsl-modules
|
|
|
|
# Required-Start:
|
|
|
|
# Required-Stop:
|
|
|
|
# Should-Start:
|
|
|
|
# Should-Stop:
|
|
|
|
# Default-Start: S
|
|
|
|
# Default-Stop: 0 6
|
|
|
|
# Short-Description: Load OpenNSL kernel modules
|
|
|
|
### END INIT INFO
|
|
|
|
|
2018-08-31 10:54:27 -05:00
|
|
|
function create_devices()
|
|
|
|
{
|
|
|
|
rm -f /dev/linux-knet-cb
|
|
|
|
rm -f /dev/linux-bcm-knet
|
|
|
|
rm -f /dev/linux-bcm-bde
|
|
|
|
rm -f /dev/linux-kernel-bde
|
|
|
|
|
|
|
|
mknod /dev/linux-knet-cb c 121 0
|
|
|
|
mknod /dev/linux-bcm-knet c 122 0
|
|
|
|
mknod /dev/linux-bcm-bde c 126 0
|
|
|
|
mknod /dev/linux-kernel-bde c 127 0
|
|
|
|
}
|
2018-08-07 02:14:37 -05:00
|
|
|
|
2019-05-02 10:05:33 -05:00
|
|
|
# linux-kernel-bde debug=4 ==> Verbose level debug
|
|
|
|
# dma_debug=1 ==> Enable DMA debug
|
|
|
|
# linux-bcm-knet debug=0x5020 ==> Enable KNET Warning(0x1000),
|
|
|
|
# Events(0x20) and Instance(0x4000)
|
|
|
|
# level logs
|
2018-08-31 10:54:27 -05:00
|
|
|
function load_kernel_modules()
|
|
|
|
{
|
2019-05-02 10:05:33 -05:00
|
|
|
modprobe linux-kernel-bde dmasize=32M maxpayload=128 debug=4 dma_debug=1
|
2018-08-31 10:54:27 -05:00
|
|
|
modprobe linux-user-bde
|
2019-05-02 10:05:33 -05:00
|
|
|
modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238 debug=0x5020
|
2018-08-31 10:54:27 -05:00
|
|
|
modprobe linux-knet-cb
|
|
|
|
}
|
2018-08-27 17:03:24 -05:00
|
|
|
|
2018-08-31 10:54:27 -05:00
|
|
|
function remove_kernel_modules()
|
|
|
|
{
|
|
|
|
rmmod linux-knet-cb
|
|
|
|
rmmod linux-bcm-knet
|
|
|
|
rmmod linux-user-bde
|
|
|
|
rmmod linux-kernel-bde
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Load OpenNSL kernel modules... "
|
2018-08-27 17:03:24 -05:00
|
|
|
|
2018-08-31 10:54:27 -05:00
|
|
|
create_devices
|
|
|
|
load_kernel_modules
|
2018-08-07 02:14:37 -05:00
|
|
|
|
2018-08-31 10:54:27 -05:00
|
|
|
echo "done."
|
|
|
|
;;
|
2018-08-07 02:14:37 -05:00
|
|
|
|
|
|
|
stop)
|
2018-08-31 10:54:27 -05:00
|
|
|
echo -n "Unload OpenNSL kernel modules... "
|
2018-08-07 02:14:37 -05:00
|
|
|
|
2018-08-31 10:54:27 -05:00
|
|
|
remove_kernel_modules
|
2018-08-07 02:14:37 -05:00
|
|
|
|
2018-08-31 10:54:27 -05:00
|
|
|
echo "done."
|
|
|
|
;;
|
2018-08-07 02:14:37 -05:00
|
|
|
|
|
|
|
force-reload|restart)
|
2018-08-31 10:54:27 -05:00
|
|
|
echo "Not supported"
|
|
|
|
;;
|
2018-08-07 02:14:37 -05:00
|
|
|
|
|
|
|
*)
|
2019-01-25 02:46:09 -06:00
|
|
|
echo "Usage: /etc/init.d/opennsl-modules.init {start|stop}"
|
2018-08-31 10:54:27 -05:00
|
|
|
exit 1
|
|
|
|
;;
|
2018-08-07 02:14:37 -05:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|