FAPI TM, WLS_LIB and ODULOW documentation
[o-du/phy.git] / wls_lib / wls_start.sh
1 #!/bin/bash
2 ###############################################################################
3 #
4 #   Copyright (c) 2019 Intel.
5 #
6 #   Licensed under the Apache License, Version 2.0 (the "License");
7 #   you may not use this file except in compliance with the License.
8 #   You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #   Unless required by applicable law or agreed to in writing, software
13 #   distributed under the License is distributed on an "AS IS" BASIS,
14 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #   See the License for the specific language governing permissions and
16 #   limitations under the License.
17 #
18 ###############################################################################
19 #
20 #  File: wls_start.sh
21 #        Test script to load wls module.
22 #
23
24 export RTE_WLS=`pwd`
25
26 #
27 # Unloads wls.ko.
28 #
29 remove_wls_module()
30 {
31     echo "Unloading WLS module"
32     /sbin/lsmod | grep -s wls > /dev/null
33     if [ $? -eq 0 ] ; then
34         sudo /sbin/rmmod wls
35     fi
36 }
37
38 #
39 # Loads new wls.ko
40 #
41 load_wls_module()
42 {
43     if [ ! -f $RTE_WLS/wls.ko ];then
44         echo "## ERROR: Folder does not have the WLS Kernel Module."
45         echo "       To fix, please try to rebuild WLS"
46         return
47     fi
48
49     remove_wls_module
50
51     /sbin/lsmod | grep -s wls > /dev/null
52     if [ $? -eq 1 ] ; then
53         if [ -f /lib/modules/$(uname -r)/updates/drivers/intel/wls/wls.ko ] ; then
54             echo "Loading WLS module"
55             sudo /sbin/modprobe wls wlsMaxClients=4
56         else
57             echo "No module. WLS is not istalled? do 'make install'"
58         fi
59     fi
60 }
61
62 load_wls_module
63
64
65