74 lines
1.8 KiB
Bash
Executable File
74 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# vim: set ts=2 sw=2 et:
|
|
# /etc/bewan/lib/ethptm
|
|
|
|
# specific vendor functions used by ethptm scripts
|
|
# setparam must be included
|
|
|
|
# Working variables
|
|
# $ETHID: PTMEternetInterface index
|
|
# $ifname: name of ptm network interface
|
|
# $PTMD/$ifname: working directory of PTM interface
|
|
|
|
export LD_LIBRARY_PATH=/lib/public:/lib/private:/lib/gpl:/lib
|
|
|
|
if [ ${PTM_LIB_LOADED:-0} -eq 1 ]; then
|
|
return
|
|
fi
|
|
|
|
. /etc/bewan/lib/qos
|
|
|
|
check_vendor_ethptm() {
|
|
mkdir -p $PTMD
|
|
touch $PTMD/enable
|
|
|
|
which xtmctl > /dev/null
|
|
return $?
|
|
}
|
|
|
|
start_vendor_ethptm() {
|
|
|
|
>$PTMD/$ifname/bcmptmup
|
|
# TODO: ok, for now, we keep hardcoded values for mpaal stuff (this is only available on bcm963268)
|
|
echo "export LD_LIBRARY_PATH=/lib/public:/lib/private:/lib/gpl:/lib" >>$PTMD/$ifname/bcmptmup
|
|
echo "xtmctl operate conn --add 3.3 0 1 1" >>$PTMD/$ifname/bcmptmup
|
|
echo "xtmctl operate conn --createnetdev 3.3 $ifname" >>$PTMD/$ifname/bcmptmup
|
|
|
|
>$PTMD/$ifname/bcmptmdown
|
|
echo "export LD_LIBRARY_PATH=/lib/public:/lib/private:/lib/gpl:/lib" >>$PTMD/$ifname/bcmptmdown
|
|
echo "xtmctl operate conn --deletenetdev 3.3" >>$PTMD/$ifname/bcmptmdown
|
|
echo "xtmctl operate conn --delete 3.3" >>$PTMD/$ifname/bcmptmdown
|
|
|
|
# Ok, let's call the script
|
|
. $PTMD/$ifname/bcmptmup
|
|
|
|
queue_up_vendor_ethptm
|
|
|
|
ifconfig $ifname up
|
|
}
|
|
|
|
stop_vendor_ethptm() {
|
|
|
|
ifconfig $ifname down
|
|
queue_down_vendor_ethptm
|
|
[ -f $PTMD/$ifname/bcmptmdown ] && . $PTMD/$ifname/bcmptmdown
|
|
rm -f $PTMD/$ifname/bcmptmup $PTMD/$ifname/bcmptmdown
|
|
}
|
|
|
|
queue_up_vendor_ethptm() {
|
|
# create the QOS queues
|
|
vendor_qos_start_ifname $ifname
|
|
|
|
# or the default one
|
|
vendor_qos_add_default_queue 1 $ifname
|
|
}
|
|
|
|
queue_down_vendor_ethptm() {
|
|
# del the queues or the default queue
|
|
# attached to the $ifname
|
|
vendor_qos_stop_ifname $ifname
|
|
vendor_qos_del_default_queue $ifname
|
|
}
|
|
|
|
PTM_LIB_LOADED=1
|