From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 389A35323 for ; Thu, 22 Jun 2017 03:25:43 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2017 18:25:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,371,1493708400"; d="scan'208";a="117337255" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 21 Jun 2017 18:25:43 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 21 Jun 2017 18:25:42 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 21 Jun 2017 18:25:42 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.56]) with mapi id 14.03.0319.002; Thu, 22 Jun 2017 09:25:39 +0800 From: "Wu, Jingjing" To: "rsanford@akamai.com" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/4] testpmd: fix LACP ports to work with idle links Thread-Index: AQHS6abNWbHSbn3y5UqZGN8PJ6mjR6IwFjwQ Date: Thu, 22 Jun 2017 01:25:39 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810DAC7D9@SHSMSX103.ccr.corp.intel.com> References: <1470084176-79932-1-git-send-email-rsanford@akamai.com> <1470084176-79932-2-git-send-email-rsanford@akamai.com> In-Reply-To: <1470084176-79932-2-git-send-email-rsanford@akamai.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 01:25:44 -0000 > -----Original Message----- > From: rsanford2 at gmail.com > Sent: Tuesday, August 2, 2016 4:43 AM > Subject: [dpdk-dev] [PATCH 1/4] testpmd: fix LACP ports to work with idle= links >=20 > Problem: When there is little or no TX traffic on an LACP port (bonding m= ode 4), > we don't call its tx burst function in a timely manner, and thus we don't > transmit LACPDUs when we should. >=20 > 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 o= f N > loops force an empty call to the tx burst API. >=20 > 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(-) >=20 > 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 !=3D rte_eth_bond_mode_set(port_id, res->value)) > printf("\t Failed to set bonding mode for port =3D %d.\n", port_id); > + else if (res->value =3D=3D BONDING_MODE_8023AD) > + set_port_lacp_master(port_id); > + else > + clear_port_lacp_master(port_id); > } >=20 > cmdline_parse_token_string_t cmd_setbonding_mode_set =3D @@ -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 =3D 1; > + > + if (res->mode =3D=3D BONDING_MODE_8023AD) > + set_port_lacp_master(port_id); > + else > + clear_port_lacp_master(port_id); > } >=20 > } > 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 =3D 0; >=20 > fsm =3D &fwd_streams[fc->stream_idx]; > nb_fs =3D fc->stream_nb; > do { > for (sm_id =3D 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 !=3D 0)) > + continue; > + for (sm_id =3D 0; sm_id < nb_fs; sm_id++) { > + struct fwd_stream *fs =3D fsm[sm_id]; > + > + if (port_is_lacp_master(fs->tx_port)) > + rte_eth_tx_burst(fs->tx_port, fs->tx_queue, > + NULL, 0); > + } By add tx_burst here will change default logic. Some fwd engine are usually= used to measure Performance . Additional cycle in fast path may impact that. It would be be= tter to move additional sending to your fwd engine. > } while (! fc->stopped); > } >=20 > @@ -1881,6 +1897,27 @@ uint8_t port_is_bonding_slave(portid_t slave_pid) > return port->slave_flag; > } >=20 > +void set_port_lacp_master(portid_t pid) { > + struct rte_port *port =3D &ports[pid]; > + You may need to check the pid is valid or not. And the function is simple, could you just assign the lacp_master in the caller instead of defining a new one? > + port->lacp_master =3D 1; > +} > + > +void clear_port_lacp_master(portid_t pid) { > + struct rte_port *port =3D &ports[pid]; > + Same comment as above. > + port->lacp_master =3D 0; > +} > + > +uint8_t port_is_lacp_master(portid_t pid) { > + struct rte_port *port =3D &ports[pid]; > + > + return port->lacp_master; > +} > + > const uint16_t vlan_tags[] =3D { > 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 */ > }; >=20 > 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(port= id_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); >=20 > int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode, > enum rte_eth_nb_tcs num_tcs, > -- > 1.7.1 >=20