From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Yigit, Ferruh" <ferruh.yigit@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v5 4/4] examples/ethtool: add control interface support to the application
Date: Wed, 9 Mar 2016 12:23:09 +0000 [thread overview]
Message-ID: <2601191342CEEE43887BDE71AB97725836B1A3F8@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <1457523689-6223-5-git-send-email-ferruh.yigit@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Wednesday, March 09, 2016 11:41 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v5 4/4] examples/ethtool: add control interface support to the application
>
> Control interface APIs added into the sample application.
>
> To have the support corresponding kernel module (KCP) needs to be inserted.
> If kernel module is not there, application will run as it is without
> kernel control path support.
>
> When KCP module inserted, running application creates a virtual Linux
> network interface (dpdk$) per DPDK port. This interface can be used by
> traditional Linux tools.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Acked-by: Remy Horton <remy.horton@intel.com>
> ---
>
> v4, v5:
> * No update
>
> v3:
> * Use blocking mode control interface processing, instead of poll mode
>
> v2:
> * No update on sample app
> ---
> doc/guides/sample_app_ug/ethtool.rst | 41 ++++++++++++++++++++++++++++++++++++
> examples/ethtool/main.c | 31 +++++++++++++++++++++++++--
> 2 files changed, 70 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst
> index 65240ae..af591c2 100644
> --- a/doc/guides/sample_app_ug/ethtool.rst
> +++ b/doc/guides/sample_app_ug/ethtool.rst
> @@ -130,3 +130,44 @@ interface that accepts commands as described in `using the
> application`_. Individual call-back functions handle the detail
> associated with each command, which make use of librte_ethtool
> library.
> +
> +Control Interface
> +~~~~~~~~~~~~~~~~~
> +
> +If Kernel Control Path (KCP) kernel module (rte_kcp.ko) inserted,
> +virtual interfaces created for each DPDK port for control purposes.
> +
> +Created interfaces are named as dpdk#, like:
> +
> +.. code-block:: console
> +
> + # ifconfig dpdk0; ifconfig dpdk1
> + dpdk0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
> + ether 90:e2:ba:0e:49:b9 txqueuelen 1000 (Ethernet)
> + RX packets 0 bytes 0 (0.0 B)
> + RX errors 0 dropped 0 overruns 0 frame 0
> + TX packets 0 bytes 0 (0.0 B)
> + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
> +
> + dpdk1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
> + ether 00:1b:21:76:fa:21 txqueuelen 1000 (Ethernet)
> + RX packets 0 bytes 0 (0.0 B)
> + RX errors 0 dropped 0 overruns 0 frame 0
> + TX packets 0 bytes 0 (0.0 B)
> + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
> +
> +Regular Linux commands can be issued on interfaces:
> +
> +.. code-block:: console
> +
> + # ethtool -i dpdk0
> + driver: rte_ixgbe_pmd
> + version: RTE 2.3.0-rc0
> + firmware-version:
> + expansion-rom-version:
> + bus-info: 0000:08:00.1
> + supports-statistics: yes
> + supports-test: no
> + supports-eeprom-access: yes
> + supports-register-dump: yes
> + supports-priv-flags: no
> diff --git a/examples/ethtool/main.c b/examples/ethtool/main.c
> index 2c655d8..72fbe4c 100644
> --- a/examples/ethtool/main.c
> +++ b/examples/ethtool/main.c
> @@ -1,7 +1,7 @@
> /*-
> * BSD LICENSE
> *
> - * Copyright(c) 2015 Intel Corporation. All rights reserved.
> + * Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> @@ -44,6 +44,7 @@
> #include <rte_memory.h>
> #include <rte_mempool.h>
> #include <rte_mbuf.h>
> +#include <rte_ctrl_if.h>
>
> #include "ethapp.h"
>
> @@ -54,7 +55,6 @@
> #define PKTPOOL_EXTRA_SIZE 512
> #define PKTPOOL_CACHE 32
>
> -
> struct txq_port {
> uint16_t cnt_unsent;
> struct rte_mbuf *buf_frames[MAX_BURST_LENGTH];
> @@ -259,11 +259,32 @@ static int slave_main(__attribute__((unused)) void *ptr_data)
> return 0;
> }
>
> +static void *
> +control_function(__attribute__((unused)) void *arg)
> +{
> + int port_id;
> +
> + while (1) {
> + /* blocking call with 1 sec timeout */
> + port_id = rte_eth_control_interface_msg_exist(1);
> + if (port_id < 0)
> + continue;
> +
> + lock_port(port_id);
> + rte_eth_control_interface_msg_process(
> + RTE_ETHTOOL_CTRL_IF_PROCESS_MSG);
> + unlock_port(port_id);
As I stated in offline code review, I think that just lock/unlock here is not enough.
You either have to update port_active flag here based on dev->data->dev_started,
or check dev->data->dev_started directly in your data-path or somehow else
inform IO thread that the port is stopped and RX/TX is not possible over it.
Otherwise sending stop command over your control interface while RX/TX is active
would cause your app to crash.
Konstantin
> + }
> +
> + return 0;
> +}
> +
> int main(int argc, char **argv)
> {
> int cnt_args_parsed;
> uint32_t id_core;
> uint32_t cnt_ports;
> + pthread_t control_thread;
>
> /* Init runtime enviornment */
> cnt_args_parsed = rte_eal_init(argc, argv);
> @@ -293,6 +314,9 @@ int main(int argc, char **argv)
> id_core = rte_get_next_lcore(id_core, 1, 1);
> rte_eal_remote_launch(slave_main, NULL, id_core);
>
> + pthread_create(&control_thread, NULL, control_function, NULL);
> + rte_eth_control_interface_create();
> +
> ethapp_main();
>
> app_cfg.exit_now = 1;
> @@ -301,5 +325,8 @@ int main(int argc, char **argv)
> return -1;
> }
>
> + rte_eth_control_interface_destroy();
> + pthread_cancel(control_thread);
> +
> return 0;
> }
> --
> 2.5.0
next prev parent reply other threads:[~2016-03-09 12:23 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1453911849-16562-1-git-send-email-ferruh.yigit@intel.com>
2016-01-27 16:24 ` [dpdk-dev] [PATCH 1/3] kcp: add kernel control path kernel module Ferruh Yigit
2016-01-28 9:49 ` Remy Horton
2016-01-28 13:50 ` Ferruh Yigit
2016-02-28 15:34 ` Avi Kivity
2016-02-28 20:16 ` Ferruh Yigit
2016-02-29 9:43 ` Avi Kivity
2016-02-29 10:43 ` Ferruh Yigit
2016-02-29 10:58 ` Avi Kivity
2016-02-29 11:06 ` Thomas Monjalon
2016-02-29 11:35 ` Ferruh Yigit
2016-02-29 15:05 ` Ferruh Yigit
2016-02-29 15:19 ` Panu Matilainen
2016-02-29 15:27 ` Thomas Monjalon
2016-02-29 16:04 ` Panu Matilainen
2016-02-29 14:33 ` Jay Rolette
2016-03-01 22:40 ` Bruce Richardson
2016-03-02 2:02 ` Stephen Hemminger
2016-03-02 8:27 ` Panu Matilainen
2016-03-02 10:47 ` Vincent JARDIN
2016-03-02 10:51 ` Jim Thompson
2016-03-02 12:03 ` Vincent JARDIN
2016-03-02 22:51 ` Jim Thompson
2016-03-02 11:21 ` Thomas Monjalon
2016-03-02 22:35 ` Thomas Monjalon
2016-03-03 8:31 ` Panu Matilainen
2016-03-03 10:05 ` Ferruh Yigit
2016-03-03 10:11 ` Thomas Monjalon
2016-03-03 10:51 ` Panu Matilainen
2016-03-10 0:04 ` Thomas Monjalon
2016-03-10 6:31 ` Vincent JARDIN
2016-03-02 22:18 ` Jay Rolette
2016-03-03 10:11 ` Ferruh Yigit
2016-03-03 16:59 ` Stephen Hemminger
2016-03-03 18:18 ` Ferruh Yigit
2016-02-29 11:27 ` Ferruh Yigit
2016-02-29 11:39 ` Avi Kivity
2016-02-29 14:35 ` Ferruh Yigit
2016-02-29 20:11 ` Stephen Hemminger
2016-03-01 0:35 ` Ferruh Yigit
2016-01-27 16:24 ` [dpdk-dev] [PATCH 2/3] rte_ctrl_if: add control interface library Ferruh Yigit
2016-01-28 11:14 ` Remy Horton
2016-01-28 13:15 ` Ferruh Yigit
2016-01-28 13:24 ` Jay Rolette
2016-01-28 13:56 ` Ferruh Yigit
2016-01-28 13:57 ` Ananyev, Konstantin
2016-01-28 14:22 ` Yigit, Ferruh
2016-01-27 16:24 ` [dpdk-dev] [PATCH 3/3] examples/ethtool: add control interface support to the application Ferruh Yigit
2016-02-12 13:45 ` [dpdk-dev] [PATCH v2 0/3] Use common Linux tools to control DPDK ports Ferruh Yigit
2016-02-12 13:45 ` [dpdk-dev] [PATCH v2 1/3] kcp: add kernel control path kernel module Ferruh Yigit
2016-02-12 13:45 ` [dpdk-dev] [PATCH v2 2/3] rte_ctrl_if: add control interface library Ferruh Yigit
2016-02-17 19:58 ` Ananyev, Konstantin
2016-02-18 10:43 ` Yigit, Ferruh
2016-02-12 13:45 ` [dpdk-dev] [PATCH v2 3/3] examples/ethtool: add control interface support to the application Ferruh Yigit
2016-02-17 19:39 ` Ananyev, Konstantin
2016-02-18 10:11 ` Yigit, Ferruh
2016-02-26 14:10 ` [dpdk-dev] [PATCH v3 0/4] Use common Linux tools to control DPDK ports Ferruh Yigit
2016-02-26 14:10 ` [dpdk-dev] [PATCH v3 1/4] lib/librte_ethtool: move librte_ethtool form examples to lib folder Ferruh Yigit
2016-02-26 14:10 ` [dpdk-dev] [PATCH v3 2/4] kcp: add kernel control path kernel module Ferruh Yigit
2016-03-01 1:02 ` Stephen Hemminger
2016-03-01 15:53 ` Ferruh Yigit
2016-02-26 14:10 ` [dpdk-dev] [PATCH v3 3/4] rte_ctrl_if: add control interface library Ferruh Yigit
2016-02-26 14:10 ` [dpdk-dev] [PATCH v3 4/4] examples/ethtool: add control interface support to the application Ferruh Yigit
2016-02-29 9:33 ` [dpdk-dev] [PATCH v3 0/4] Use common Linux tools to control DPDK ports Remy Horton
2016-03-01 15:41 ` [dpdk-dev] [PATCH v4 " Ferruh Yigit
2016-03-01 15:41 ` [dpdk-dev] [PATCH v4 1/4] lib/librte_ethtool: move librte_ethtool form examples to lib folder Ferruh Yigit
2016-03-01 15:41 ` [dpdk-dev] [PATCH v4 2/4] kcp: add kernel control path kernel module Ferruh Yigit
2016-03-01 23:06 ` Stephen Hemminger
2016-03-02 11:05 ` Ferruh Yigit
2016-03-01 23:09 ` Stephen Hemminger
2016-03-01 23:10 ` Stephen Hemminger
2016-03-02 11:06 ` Ferruh Yigit
2016-03-01 15:41 ` [dpdk-dev] [PATCH v4 3/4] rte_ctrl_if: add control interface library Ferruh Yigit
2016-03-01 15:42 ` [dpdk-dev] [PATCH v4 4/4] examples/ethtool: add control interface support to the application Ferruh Yigit
2016-03-09 11:41 ` [dpdk-dev] [PATCH v5 0/4] Use common Linux tools to control DPDK ports Ferruh Yigit
2016-03-09 11:41 ` [dpdk-dev] [PATCH v5 1/4] lib/librte_ethtool: move librte_ethtool form examples to lib folder Ferruh Yigit
2016-03-09 11:41 ` [dpdk-dev] [PATCH v5 2/4] kcp: add kernel control path kernel module Ferruh Yigit
2016-03-09 11:41 ` [dpdk-dev] [PATCH v5 3/4] rte_ctrl_if: add control interface library Ferruh Yigit
2016-03-09 11:41 ` [dpdk-dev] [PATCH v5 4/4] examples/ethtool: add control interface support to the application Ferruh Yigit
2016-03-09 12:23 ` Ananyev, Konstantin [this message]
2016-03-14 15:31 ` [dpdk-dev] [PATCH v5 0/4] Use common Linux tools to control DPDK ports Ferruh Yigit
2016-03-14 17:40 ` Jay Rolette
2016-03-15 0:00 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2601191342CEEE43887BDE71AB97725836B1A3F8@irsmsx105.ger.corp.intel.com \
--to=konstantin.ananyev@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).