Skip to content
Snippets Groups Projects
Commit 30830bc8 authored by Tomas Hlavacek's avatar Tomas Hlavacek
Browse files

Omnia: Make sure sfp switch brings the NIC down

The sfpswitch daemon has to bring the NIC down for sure before
calling network restart.

Add safety timeout to be sure the network down/up happens after
the switch is comitted to the kernel.
parent cde99f3c
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
import sys
import os
import select
import time
sfpdet_pin = 508
sfpdis_pin = 505
......@@ -10,7 +11,8 @@ sfpdis_pin = 505
gpio_export = '/sys/class/gpio/export'
sfp_select = '/sys/devices/platform/soc/soc:internal-regs/f1034000.ethernet/net/eth1/phy_select'
map = { 1: 'phy-def', 0: 'phy-sfp' }
cmd_net_res = '/etc/init.d/network restart'
cmd_net_res = 'ip link set down dev eth1; /etc/init.d/network restart'
cmd_safety_sleep = 2
def write_once(path, value):
with open(path, 'w') as f:
......@@ -47,6 +49,7 @@ def do_switch(state, restart_net=True):
print 'Switching state to %s' % map[state]
write_once(sfp_select, map[state])
if restart_net:
time.sleep(cmd_safety_sleep)
os.system(cmd_net_res)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment