OSDN Git Service

samples: pktgen: fix proc_cmd command result check logic
authorDaniel T. Lee <danieltimlee@gmail.com>
Sat, 5 Oct 2019 08:25:07 +0000 (17:25 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Jan 2020 12:34:11 +0000 (13:34 +0100)
commitd79d036dabed23b8c1ede9bd648822dc38304bdd
tree1c22ed5e57af101707793cb04c6a6e22e3fab60b
parentf19a9d8f467e000a176301261b872ca68dc92519
samples: pktgen: fix proc_cmd command result check logic

[ Upstream commit 3cad8f911575191fb3b81d8ed0e061e30f922223 ]

Currently, proc_cmd is used to dispatch command to 'pg_ctrl', 'pg_thread',
'pg_set'. proc_cmd is designed to check command result with grep the
"Result:", but this might fail since this string is only shown in
'pg_thread' and 'pg_set'.

This commit fixes this logic by grep-ing the "Result:" string only when
the command is not for 'pg_ctrl'.

For clarity of an execution flow, 'errexit' flag has been set.

To cleanup pktgen on exit, trap has been added for EXIT signal.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
samples/pktgen/functions.sh