[ovs-dev] [PATCH v2] dpif-netdev: Add dpif-netdev/pmd-rxq-show appctl command.
Ilya Maximets
i.maximets at samsung.com
Mon Feb 8 07:38:47 UTC 2016
This command can be used to check the port/rxq assignment to
pmd threads. For each pmd thread of the datapath shows list
of queue-ids with port names.
Additionally log message from pmd_thread_main() extended with
queue-id, and type of this message changed from INFO to DBG.
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
---
Version 2:
* command renamed to 'pmd-rxq-show'.
* Added note to NEWS.
INSTALL.DPDK.md | 9 ++++--
NEWS | 3 ++
lib/dpif-netdev.c | 77 ++++++++++++++++++++++++++++++++++------------
lib/netdev.c | 6 ++++
lib/netdev.h | 1 +
vswitchd/ovs-vswitchd.8.in | 3 ++
6 files changed, 77 insertions(+), 22 deletions(-)
diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md
index d892788..a528068 100644
--- a/INSTALL.DPDK.md
+++ b/INSTALL.DPDK.md
@@ -272,9 +272,12 @@ Performance Tuning:
NIC port0 <-> OVS <-> VM <-> OVS <-> NIC port 1
- The OVS log can be checked to confirm that the port/rxq assignment to
- pmd threads is as required. This can also be checked with the following
- commands:
+ The following command can be used to confirm that the port/rxq assignment
+ to pmd threads is as required:
+
+ `ovs-appctl dpif-netdev/pmd-rxq-show`
+
+ This can also be checked with:
```
top -H
diff --git a/NEWS b/NEWS
index 3e33871..ad21ac6 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ Post-v2.5.0
- DPDK:
* New option "n_rxq" for PMD interfaces.
Old 'other_config:n-dpdk-rxqs' is no longer supported.
+ * New appctl command 'dpif-netdev/pmd-rxq-show' to check the port/rxq
+ assignment.
+ * Type of log messages from PMD threads changed from INFO to DBG.
- ovs-benchmark: This utility has been removed due to lack of use and
bitrot.
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c477f2b..ac19cdf 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -568,8 +568,9 @@ get_dp_netdev(const struct dpif *dpif)
}
enum pmd_info_type {
- PMD_INFO_SHOW_STATS, /* show how cpu cycles are spent */
- PMD_INFO_CLEAR_STATS /* set the cycles count to 0 */
+ PMD_INFO_SHOW_STATS, /* Show how cpu cycles are spent. */
+ PMD_INFO_CLEAR_STATS, /* Set the cycles count to 0. */
+ PMD_INFO_SHOW_RXQ /* Show poll-lists of pmd threads. */
};
static void
@@ -678,6 +679,35 @@ pmd_info_clear_stats(struct ds *reply OVS_UNUSED,
}
static void
+pmd_info_show_rxq(struct ds *reply, struct dp_netdev_pmd_thread *pmd)
+{
+ if (pmd->core_id != NON_PMD_CORE_ID) {
+ struct rxq_poll *poll;
+ const char *prev_name = NULL;
+
+ ds_put_format(reply, "pmd thread numa_id %d core_id %u:\n",
+ pmd->numa_id, pmd->core_id);
+
+ ovs_mutex_lock(&pmd->poll_mutex);
+ LIST_FOR_EACH (poll, node, &pmd->poll_list) {
+ const char *name = netdev_get_name(poll->port->netdev);
+
+ if (!prev_name || strcmp(name, prev_name)) {
+ if (prev_name) {
+ ds_put_cstr(reply, "\n");
+ }
+ ds_put_format(reply, "\tport: %s\tqueue-id:",
+ netdev_get_name(poll->port->netdev));
+ }
+ ds_put_format(reply, " %d", netdev_rxq_get_queue_id(poll->rx));
+ prev_name = name;
+ }
+ ovs_mutex_unlock(&pmd->poll_mutex);
+ ds_put_cstr(reply, "\n");
+ }
+}
+
+static void
dpif_netdev_pmd_info(struct unixctl_conn *conn, int argc, const char *argv[],
void *aux)
{
@@ -703,22 +733,26 @@ dpif_netdev_pmd_info(struct unixctl_conn *conn, int argc, const char *argv[],
}
CMAP_FOR_EACH (pmd, node, &dp->poll_threads) {
- unsigned long long stats[DP_N_STATS];
- uint64_t cycles[PMD_N_CYCLES];
- int i;
+ if (type == PMD_INFO_SHOW_RXQ) {
+ pmd_info_show_rxq(&reply, pmd);
+ } else {
+ unsigned long long stats[DP_N_STATS];
+ uint64_t cycles[PMD_N_CYCLES];
+ int i;
- /* Read current stats and cycle counters */
- for (i = 0; i < ARRAY_SIZE(stats); i++) {
- atomic_read_relaxed(&pmd->stats.n[i], &stats[i]);
- }
- for (i = 0; i < ARRAY_SIZE(cycles); i++) {
- atomic_read_relaxed(&pmd->cycles.n[i], &cycles[i]);
- }
+ /* Read current stats and cycle counters */
+ for (i = 0; i < ARRAY_SIZE(stats); i++) {
+ atomic_read_relaxed(&pmd->stats.n[i], &stats[i]);
+ }
+ for (i = 0; i < ARRAY_SIZE(cycles); i++) {
+ atomic_read_relaxed(&pmd->cycles.n[i], &cycles[i]);
+ }
- if (type == PMD_INFO_CLEAR_STATS) {
- pmd_info_clear_stats(&reply, pmd, stats, cycles);
- } else if (type == PMD_INFO_SHOW_STATS) {
- pmd_info_show_stats(&reply, pmd, stats, cycles);
+ if (type == PMD_INFO_CLEAR_STATS) {
+ pmd_info_clear_stats(&reply, pmd, stats, cycles);
+ } else if (type == PMD_INFO_SHOW_STATS) {
+ pmd_info_show_stats(&reply, pmd, stats, cycles);
+ }
}
}
@@ -732,7 +766,8 @@ static int
dpif_netdev_init(void)
{
static enum pmd_info_type show_aux = PMD_INFO_SHOW_STATS,
- clear_aux = PMD_INFO_CLEAR_STATS;
+ clear_aux = PMD_INFO_CLEAR_STATS,
+ poll_aux = PMD_INFO_SHOW_RXQ;
unixctl_command_register("dpif-netdev/pmd-stats-show", "[dp]",
0, 1, dpif_netdev_pmd_info,
@@ -740,6 +775,9 @@ dpif_netdev_init(void)
unixctl_command_register("dpif-netdev/pmd-stats-clear", "[dp]",
0, 1, dpif_netdev_pmd_info,
(void *)&clear_aux);
+ unixctl_command_register("dpif-netdev/pmd-rxq-show", "[dp]",
+ 0, 1, dpif_netdev_pmd_info,
+ (void *)&poll_aux);
return 0;
}
@@ -2694,8 +2732,9 @@ reload:
/* List port/core affinity */
for (i = 0; i < poll_cnt; i++) {
- VLOG_INFO("Core %d processing port \'%s\'\n", pmd->core_id,
- netdev_get_name(poll_list[i].port->netdev));
+ VLOG_DBG("Core %d processing port \'%s\' with queue-id %d\n",
+ pmd->core_id, netdev_get_name(poll_list[i].port->netdev),
+ netdev_rxq_get_queue_id(poll_list[i].rx));
}
/* Signal here to make sure the pmd finishes
diff --git a/lib/netdev.c b/lib/netdev.c
index c250c93..8ed9e7e 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -1807,6 +1807,12 @@ netdev_rxq_get_name(const struct netdev_rxq *rx)
return netdev_get_name(netdev_rxq_get_netdev(rx));
}
+int
+netdev_rxq_get_queue_id(const struct netdev_rxq *rx)
+{
+ return rx->queue_id;
+}
+
static void
restore_all_flags(void *aux OVS_UNUSED)
{
diff --git a/lib/netdev.h b/lib/netdev.h
index 8a7f680..a81989e 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -175,6 +175,7 @@ int netdev_rxq_open(struct netdev *, struct netdev_rxq **, int id);
void netdev_rxq_close(struct netdev_rxq *);
const char *netdev_rxq_get_name(const struct netdev_rxq *);
+int netdev_rxq_get_queue_id(const struct netdev_rxq *);
int netdev_rxq_recv(struct netdev_rxq *rx, struct dp_packet **buffers,
int *cnt);
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index 49c2a40..b628f2f 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -256,6 +256,9 @@ measuring infrastructure.
Resets to zero the per pmd thread performance numbers shown by the
\fBdpif-netdev/pmd-stats-show\fR command. It will NOT reset datapath or
bridge statistics, only the values shown by the above command.
+.IP "\fBdpif-netdev/pmd-rxq-show\fR [\fIdp\fR]"
+For each pmd thread of the datapath \fIdp\fR shows list of queue-ids with
+port names, which this thread polls.
.
.so ofproto/ofproto-dpif-unixctl.man
.so ofproto/ofproto-unixctl.man
--
2.1.0
More information about the dev
mailing list