From patchwork Thu May 19 08:48:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 68111 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3073569qge; Thu, 19 May 2016 01:48:41 -0700 (PDT) X-Received: by 10.55.160.72 with SMTP id j69mr12754121qke.108.1463647721929; Thu, 19 May 2016 01:48:41 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e83si11326920qhd.52.2016.05.19.01.48.41; Thu, 19 May 2016 01:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 80E9161776; Thu, 19 May 2016 08:48:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 56E6A6156A; Thu, 19 May 2016 08:48:35 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7C11C615D8; Thu, 19 May 2016 08:48:29 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id 25F1361071 for ; Thu, 19 May 2016 08:48:28 +0000 (UTC) Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd002.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u4J8mQqk029651 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 May 2016 08:48:26 GMT Received: from 10.144.19.15 ([10.145.168.111]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u4J8mPeB003596 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 19 May 2016 10:48:26 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Thu, 19 May 2016 11:48:24 +0300 Message-Id: <1463647705-7056-1-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 6499 X-purgate-ID: 151667::1463647706-00002418-46A1B1BB/0/0 X-Topics: patch Subject: [lng-odp] [PATCH 1/2] linux-generic: pktio: add pktio type specific print function X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Add new function pointer 'print' to pktio_if_ops_t. This can be used to print pktio type specific debug information. In case of netmap, it is used to print the current RSS configuration. rss_conf_print() output format was modified to be in line with odp_pktio_print(). Signed-off-by: Matias Elo Reviewed-by: Bill Fischofer --- platform/linux-generic/include/odp_packet_io_internal.h | 1 + platform/linux-generic/odp_packet_io.c | 7 ++++++- platform/linux-generic/pktio/ipc.c | 1 + platform/linux-generic/pktio/loop.c | 1 + platform/linux-generic/pktio/netmap.c | 10 ++++++++++ platform/linux-generic/pktio/pcap.c | 1 + platform/linux-generic/pktio/socket.c | 17 +++++++++-------- platform/linux-generic/pktio/socket_mmap.c | 1 + platform/linux-generic/pktio/tap.c | 1 + 9 files changed, 31 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 7dd578b..5adfc7e 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -175,6 +175,7 @@ int is_free(pktio_entry_t *entry); typedef struct pktio_if_ops { const char *name; + void (*print)(pktio_entry_t *pktio_entry); int (*init_global)(void); int (*init_local)(void); int (*term)(void); diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index db5a3df..15763df 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1028,7 +1028,12 @@ void odp_pktio_print(odp_pktio_t id) odp_pktio_promisc_mode(id) ? "yes" : "no"); str[len] = '\0'; - ODP_PRINT("\n%s\n", str); + ODP_PRINT("\n%s", str); + + if (entry->s.ops->print) + entry->s.ops->print(entry); + + ODP_PRINT("\n"); } int odp_pktio_term_global(void) diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index 12cc286..d499a19 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -726,6 +726,7 @@ static int ipc_close(pktio_entry_t *pktio_entry) const pktio_if_ops_t ipc_pktio_ops = { .name = "ipc", + .print = NULL, .init_global = NULL, .init_local = NULL, .term = NULL, diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 38acff1..cbb5ea9 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -206,6 +206,7 @@ static int loopback_stats_reset(pktio_entry_t *pktio_entry ODP_UNUSED) const pktio_if_ops_t loopback_pktio_ops = { .name = "loop", + .print = NULL, .init_global = NULL, .init_local = NULL, .term = NULL, diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 3e6a4f0..1042fd1 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -879,8 +879,18 @@ static int netmap_stats_reset(pktio_entry_t *pktio_entry) pktio_entry->s.pkt_nm.sockfd); } +static void netmap_print(pktio_entry_t *pktio_entry) +{ + odp_pktin_hash_proto_t hash_proto; + + if (rss_conf_get_fd(pktio_entry->s.pkt_nm.sockfd, + pktio_entry->s.pkt_nm.if_name, &hash_proto)) + rss_conf_print(&hash_proto); +} + const pktio_if_ops_t netmap_pktio_ops = { .name = "netmap", + .print = netmap_print, .init_global = NULL, .init_local = NULL, .term = NULL, diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index aab6b42..aeb20ed 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -421,6 +421,7 @@ static int pcapif_stats(pktio_entry_t *pktio_entry, const pktio_if_ops_t pcap_pktio_ops = { .name = "pcap", + .print = NULL, .init_global = NULL, .init_local = NULL, .open = pcapif_init, diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index a0aa9af..c0de59f 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -419,29 +419,29 @@ void rss_conf_print(const odp_pktin_hash_proto_t *hash_proto) int len = 0; int n = max_len - 1; - len += snprintf(&str[len], n - len, "RSS conf\n"); + len += snprintf(&str[len], n - len, " rss conf\n"); if (hash_proto->proto.ipv4) len += snprintf(&str[len], n - len, - " IPV4\n"); + " IPV4\n"); if (hash_proto->proto.ipv4_tcp) len += snprintf(&str[len], n - len, - " IPV4 TCP\n"); + " IPV4 TCP\n"); if (hash_proto->proto.ipv4_udp) len += snprintf(&str[len], n - len, - " IPV4 UDP\n"); + " IPV4 UDP\n"); if (hash_proto->proto.ipv6) len += snprintf(&str[len], n - len, - " IPV6\n"); + " IPV6\n"); if (hash_proto->proto.ipv6_tcp) len += snprintf(&str[len], n - len, - " IPV6 TCP\n"); + " IPV6 TCP\n"); if (hash_proto->proto.ipv6_udp) len += snprintf(&str[len], n - len, - " IPV6 UDP\n"); + " IPV6 UDP\n"); str[len] = '\0'; - ODP_PRINT("\n%s\n", str); + ODP_PRINT("%s\n", str); } /* @@ -868,6 +868,7 @@ static int sock_stats_reset(pktio_entry_t *pktio_entry) const pktio_if_ops_t sock_mmsg_pktio_ops = { .name = "socket", + .print = NULL, .init_global = NULL, .init_local = NULL, .term = NULL, diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 22a762f..c14ec9f 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -672,6 +672,7 @@ static int sock_mmap_stats_reset(pktio_entry_t *pktio_entry) const pktio_if_ops_t sock_mmap_pktio_ops = { .name = "socket_mmap", + .print = NULL, .init_global = NULL, .init_local = NULL, .term = NULL, diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index 45c4ae1..4ca11e6 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -338,6 +338,7 @@ static int tap_capability(pktio_entry_t *pktio_entry ODP_UNUSED, const pktio_if_ops_t tap_pktio_ops = { .name = "tap", + .print = NULL, .init_global = NULL, .init_local = NULL, .term = NULL,