From patchwork Fri Jun 12 16:21:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iremonger, Bernard" X-Patchwork-Id: 5414 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D7045C356; Fri, 12 Jun 2015 18:22:15 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1151BC332 for ; Fri, 12 Jun 2015 18:22:12 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 12 Jun 2015 09:22:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,602,1427785200"; d="scan'208";a="507302318" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 12 Jun 2015 09:21:45 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t5CGLir0019781; Fri, 12 Jun 2015 17:21:45 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t5CGLif3028392; Fri, 12 Jun 2015 17:21:44 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id t5CGLi0H028388; Fri, 12 Jun 2015 17:21:44 +0100 From: Bernard Iremonger To: dev@dpdk.org Date: Fri, 12 Jun 2015 17:21:28 +0100 Message-Id: <1434126088-28333-3-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1434126088-28333-1-git-send-email-bernard.iremonger@intel.com> References: <1434126088-28333-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v3 2/2] test-pmd: modified testpmd for link_bonding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When the bonded port is started it also starts the slave port, but the slave port status is not set. A slave_flag has been added to struct rte_port to resolve this issue. Changes in V3: test-pmd changes added to patchset. Signed-off-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 4 +++- app/test-pmd/testpmd.c | 24 +++++++++++++++++++++--- app/test-pmd/testpmd.h | 7 +++++-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f01db2a..a9c1b8b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * Copyright(c) 2014 6WIND S.A. * All rights reserved. * @@ -3950,6 +3950,7 @@ static void cmd_add_bonding_slave_parsed(void *parsed_result, return; } init_port_config(); + set_port_slave_flag(slave_port_id); } cmdline_parse_token_string_t cmd_addbonding_slave_add = @@ -4006,6 +4007,7 @@ static void cmd_remove_bonding_slave_parsed(void *parsed_result, return; } init_port_config(); + clear_port_slave_flag(slave_port_id); } cmdline_parse_token_string_t cmd_removebonding_slave_remove = diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 82b465d..b271728 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1202,7 +1202,8 @@ all_ports_started(void) FOREACH_PORT(pi, ports) { port = &ports[pi]; /* Check if there is a port which is not started */ - if (port->port_status != RTE_PORT_STARTED) + if ((port->port_status != RTE_PORT_STARTED) && + (port->slave_flag == 0)) return 0; } @@ -1218,7 +1219,8 @@ all_ports_stopped(void) FOREACH_PORT(pi, ports) { port = &ports[pi]; - if (port->port_status != RTE_PORT_STOPPED) + if ((port->port_status != RTE_PORT_STOPPED) && + (port->slave_flag == 0)) return 0; } @@ -1810,6 +1812,22 @@ init_port_config(void) } } +void set_port_slave_flag(portid_t slave_pid) +{ + struct rte_port *port; + + port = &ports[slave_pid]; + port->slave_flag = 1; +} + +void clear_port_slave_flag(portid_t slave_pid) +{ + struct rte_port *port; + + port = &ports[slave_pid]; + port->slave_flag = 0; +} + const uint16_t vlan_tags[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c3b6700..466964d 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -159,9 +159,10 @@ struct rte_port { uint8_t need_reconfig; /**< need reconfiguring port or not */ uint8_t need_reconfig_queues; /**< need reconfiguring queues or not */ uint8_t rss_flag; /**< enable rss or not */ - uint8_t dcb_flag; /**< enable dcb */ + uint8_t dcb_flag; /**< enable dcb */ struct rte_eth_rxconf rx_conf; /**< rx configuration */ struct rte_eth_txconf tx_conf; /**< tx configuration */ + uint8_t slave_flag; /**< bonding slave port */ }; extern portid_t __rte_unused @@ -528,6 +529,8 @@ void stop_packet_forwarding(void); void dev_set_link_up(portid_t pid); void dev_set_link_down(portid_t pid); void init_port_config(void); +void set_port_slave_flag(portid_t slave_pid); +void clear_port_slave_flag(portid_t slave_pid); int init_port_dcb_config(portid_t pid,struct dcb_config *dcb_conf); int start_port(portid_t pid); void stop_port(portid_t pid);