From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) by dpdk.org (Postfix) with ESMTP id EDB665946 for ; Mon, 1 Aug 2016 22:44:58 +0200 (CEST) Received: by mail-qt0-f194.google.com with SMTP id q11so8605354qtb.2 for ; Mon, 01 Aug 2016 13:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KtWzgTXugr72iLjOk9uNgbRunmfBrUus4FWpYvbjTIk=; b=Xs52Cs9AQDE9nuxbptdl2VMr8q3g1KcUAb1fYorQmzGNZH/31NMkesE1pmN6Ls+BEL eQ0BVmq1WBhMUlcBskiMEH3nfaBvxj0wdna4FfsVe+Gyq+yUKFAhPa5qthWqCD0xWt5J lieiJBRi+3jk35E4og0XQH4Qo78Va9kgUiWeE+NgE2VXwtK6zJu5PzG7Pz7Uyt/6wamB 47SRfO6CMRo9ieok/gNJdQ5QEXJ4ZZjRjYprVOqXAJ7ZKfy5tljSPtEYYyLBL7vVyRSV KPUOOrVfd8LmP/SFWgLJA0MGJ/igpJe2b9zR5+dREZpWITrlLVtek7xgpZ9PJubcUI1n Vb2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KtWzgTXugr72iLjOk9uNgbRunmfBrUus4FWpYvbjTIk=; b=h78WFwL7wG8ty+eE1hPS+cb/6TZsII2uIQU8lqzMjiUlC3QmHrijyUviZGhkLmCaoX MAjwBBOeKU7HMpBxBmU9n+bHqyl68EhIJ4AvsmfZMLFalit4zcJ7NLvmOY8T3ZBG04m+ aFltsBAVOA0gLXJhYkV0J4Sa9vvemfHviz3Jmiss1O/MIkcvAjqZmisoN5cCBGsq9Yuq a1uIVS66SM//6Cl963bdS0+YIXfkA0lUe68hW1OsRmBmnw1vaw//DaGH9BmzWr9NGtqO OBBkLIukcdLBOure0ADIiA97Yq+BO8hWBKsk0GE9n01j9AGMJIboPCO2ezg0I35r0jSk B78w== X-Gm-Message-State: AEkoouv4pupZf3IdMVgYT5xEfdTSpIinnffm2PaGHolORvtb2IZQ3q+leCxcyz0ic3NGFA== X-Received: by 10.200.44.115 with SMTP id e48mr91632739qta.64.1470084298341; Mon, 01 Aug 2016 13:44:58 -0700 (PDT) Received: from localhost.localdomain ([23.79.237.14]) by smtp.gmail.com with ESMTPSA id i65sm18534359qtb.18.2016.08.01.13.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Aug 2016 13:44:57 -0700 (PDT) From: Robert Sanford X-Google-Original-From: Robert Sanford To: dev@dpdk.org Cc: declan.doherty@intel.com, pablo.de.lara.guarch@intel.com, olivier.matz@6wind.com Date: Mon, 1 Aug 2016 16:42:53 -0400 Message-Id: <1470084176-79932-2-git-send-email-rsanford@akamai.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1470084176-79932-1-git-send-email-rsanford@akamai.com> References: <1470084176-79932-1-git-send-email-rsanford@akamai.com> Subject: [dpdk-dev] [PATCH 1/4] testpmd: fix LACP ports to work with idle links 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: , X-List-Received-Date: Mon, 01 Aug 2016 20:44:59 -0000 Problem: When there is little or no TX traffic on an LACP port (bonding mode 4), we don't call its tx burst function in a timely manner, and thus we don't transmit LACPDUs when we should. Solution: Add and maintain an "lacp_master" flag in rte_port struct. In the main packet forwarding loop, if port is an LACP master, in 1 out of N loops force an empty call to the tx burst API. Signed-off-by: Robert Sanford --- app/test-pmd/cmdline.c | 9 +++++++++ app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 4 ++++ 3 files changed, 50 insertions(+), 0 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f90befc..2a629ee 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3975,6 +3975,10 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result, /* Set the bonding mode for the relevant port. */ if (0 != rte_eth_bond_mode_set(port_id, res->value)) printf("\t Failed to set bonding mode for port = %d.\n", port_id); + else if (res->value == BONDING_MODE_8023AD) + set_port_lacp_master(port_id); + else + clear_port_lacp_master(port_id); } cmdline_parse_token_string_t cmd_setbonding_mode_set = @@ -4408,6 +4412,11 @@ static void cmd_create_bonded_device_parsed(void *parsed_result, reconfig(port_id, res->socket); rte_eth_promiscuous_enable(port_id); ports[port_id].enabled = 1; + + if (res->mode == BONDING_MODE_8023AD) + set_port_lacp_master(port_id); + else + clear_port_lacp_master(port_id); } } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1428974..806667e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -920,12 +920,28 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) struct fwd_stream **fsm; streamid_t nb_fs; streamid_t sm_id; + unsigned int loop_count = 0; fsm = &fwd_streams[fc->stream_idx]; nb_fs = fc->stream_nb; do { for (sm_id = 0; sm_id < nb_fs; sm_id++) (*pkt_fwd)(fsm[sm_id]); + + /* + * Per rte_eth_bond.h, we must invoke LACP master's tx + * burst function at least once every 100 ms. + */ + loop_count++; + if (likely(loop_count % 1024 != 0)) + continue; + for (sm_id = 0; sm_id < nb_fs; sm_id++) { + struct fwd_stream *fs = fsm[sm_id]; + + if (port_is_lacp_master(fs->tx_port)) + rte_eth_tx_burst(fs->tx_port, fs->tx_queue, + NULL, 0); + } } while (! fc->stopped); } @@ -1881,6 +1897,27 @@ uint8_t port_is_bonding_slave(portid_t slave_pid) return port->slave_flag; } +void set_port_lacp_master(portid_t pid) +{ + struct rte_port *port = &ports[pid]; + + port->lacp_master = 1; +} + +void clear_port_lacp_master(portid_t pid) +{ + struct rte_port *port = &ports[pid]; + + port->lacp_master = 0; +} + +uint8_t port_is_lacp_master(portid_t pid) +{ + struct rte_port *port = &ports[pid]; + + return port->lacp_master; +} + 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 2b281cc..0898194 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -170,6 +170,7 @@ struct rte_port { struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ + uint8_t lacp_master;/**< bonding LACP master */ }; extern portid_t __rte_unused @@ -542,6 +543,9 @@ void init_port_config(void); void set_port_slave_flag(portid_t slave_pid); void clear_port_slave_flag(portid_t slave_pid); uint8_t port_is_bonding_slave(portid_t slave_pid); +void set_port_lacp_master(portid_t pid); +void clear_port_lacp_master(portid_t pid); +uint8_t port_is_lacp_master(portid_t pid); int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode, enum rte_eth_nb_tcs num_tcs, -- 1.7.1