Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_coalesce(interface, args):
try:
coal = ethtool.get_coalesce(interface)
except IOError:
printtab("Interrupt coalescing NOT supported on %s!" % interface)
return
changed = False
args = [a.lower() for a in args]
for arg, value in [ ( args[i], args[i + 1] ) for i in range(0, len(args), 2) ]:
real_arg = get_coalesce_dict_entry(arg)
if not real_arg:
continue
if value == "on":
value = 1
elif value == "off":
value = 0
else:
try:
def show_coalesce(interface, args = None):
printtab("Coalesce parameters for %s:" % interface)
try:
coal = ethtool.get_coalesce(interface)
except IOError:
printtab(" NOT supported!")
return
printtab("Adaptive RX: %s TX: %s" % (coal["use_adaptive_rx_coalesce"] and "on" or "off",
coal["use_adaptive_tx_coalesce"] and "on" or "off"))
printed = [ "use_adaptive_rx_coalesce",
"use_adaptive_tx_coalesce" ]
for tunable in ethtool_coalesce_msgs:
if tunable[0] == '\n':
print
else:
printtab("%s: %s" % (tunable[0], coal[tunable[1]]))
printed.append(tunable[1])