Skip to content

Commit

Permalink
Clear pmd-rxq-affinity set by ncd on its stop.
Browse files Browse the repository at this point in the history
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukr@redhat.com>
  • Loading branch information
Gowrishankar Muthukrishnan committed Oct 20, 2019
1 parent 2708fd9 commit 333066b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
25 changes: 21 additions & 4 deletions netcontrold/app/ncd.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,30 @@ def rebalance_switch(pmd_map):
cmd += "-- set Interface %s other_config:pmd-rxq-affinity=%s " % (
port_name, pmdq)

return "ovs-vsctl %s" % cmd
return "ovs-vsctl --no-wait %s" % cmd


def ncd_kill(signal, frame):
nlog.critical("Got signal %s, dump current state of PMDs .." % signal)
nlog.debug(frame.f_locals['ctx'].pmd_map)
nlog.debug(frame.f_locals['ctx'].port_to_cls)
ctx = dataif.Context
nlog.critical("Got signal %s, doing required clean up .." % signal)

# reset rebalance settings in ports
cmd = ""
for port_name, port in ctx.port_to_cls.items():
# skip port that we did not rebalance.
if not port.rebalance:
continue

cmd += "-- remove Interface %s other_config pmd-rxq-affinity " % (
port_name)

if cmd:
ret = util.exec_host_command("ovs-vsctl --no-wait %s" % cmd)
if ret == 0:
nlog.info("removed pmd-rxq-affinity in rebalanced ports.")
else:
nlog.warn("removing pmd-rxq-affinity failed for some ports.")
nlog.warn("you may check ovs-vsctl --no-wait %s" % cmd)

raise error.NcdShutdownExc

Expand Down
8 changes: 7 additions & 1 deletion netcontrold/lib/dataif.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def find_rxq_by_id(self, _id):
"""
Return Dataif_Rxq of this id if available in port.rxq_map.
Otherwise none returned.
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukr@redhat.com>
Parameters
----------
_id : int
Expand Down Expand Up @@ -249,6 +249,8 @@ class Dataif_Port(Port):
current sampling index.
rxq_rebalanced : dict
map of PMDs that its each rxq will be associated with.
rebalance : bool
in rebalance or not.
"""

__metaclass__ = Meta
Expand All @@ -259,6 +261,7 @@ class Dataif_Port(Port):
tx_cyc = [0, ] * int(config.ncd_samples_max)
tx_drop_cyc = [0, ] * int(config.ncd_samples_max)
cyc_idx = int(config.ncd_samples_max) - 1
rebalance = False

def __init__(self):
"""
Expand Down Expand Up @@ -651,6 +654,9 @@ def get_pmd_rxqs(pmd_map):
port.id = Context.port_to_id[pname]
port.numa_id = pmd.numa_id

port_cls = Context.port_to_cls[pname]
port_cls.rebalance = True

# check whether this rxq was being rebalanced.
if qid in port.rxq_rebalanced:
# In dry-run, we need to update cpu cycles consumed by
Expand Down

0 comments on commit 333066b

Please sign in to comment.