From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A3BFA0613 for ; Thu, 26 Sep 2019 11:33:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 31BA91BF5B; Thu, 26 Sep 2019 11:33:03 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40071.outbound.protection.outlook.com [40.107.4.71]) by dpdk.org (Postfix) with ESMTP id 7A24D1BF47 for ; Thu, 26 Sep 2019 11:32:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SYe4fheREsZXT3RZ+UWGRQdP1sVvzDpopHz4YxiIdZnBhZs2hMKYMpH30oLTHQxtx2DAGnvSJim6Asi6kDPiH995P0qzgS9LgBFGi6mApBuvIoWCuVbZFBwbazhZ6Zd6xMlHk0pEOtJR5puCAXKqEUks+5FXYtGyQSijidC06S56isoBFOvKiB2oLmT+2h6pUxjM/eNeWRItkTfk3V27roaDFBH3iBSwG7gDEfjE9GerOQwbFGqRMnBS4sYpqydlK3dq1LJ/cJQ3Dlba1QTVPJU93XzWUm5kS7D5/u8Q/PArdB7+LLvZF5qdPMbhtRosZhKHM9xbX3Z4PnJ/TLQfjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uNXZK2v0JkN0cn0utryVv3uIgqniUFitDZQbzwq4e8w=; b=WiTz4LHhnywHMF2PGzqoeagw20ZiWh/O7KAkUfKlL0vGbYKCA5safls9jq/7g54JrmVmWC+7DiAIfLe+j/d6i8+aJSX9Zd/nHEb6OLg3xQKAy9Mv1mSAzT8pnJLJ6LwbFCNbxN92voiwaVpyJmnbsld3/re5JKv+rw8BHT4YraP0laZtyhA++z908d+YdA+J+j50fzCOG0SZ68cpMKiYOuTIX4tfBlYB6895eQ0NrxqHgsqbniihl1eRKBhdBDC1iD/R6GVFn3VUwzr8Gc+Jy63AWK9Ce88j6Q2Z1OjGsQ2RxtNlUv5WUJuydMc2TWt97OeFWWwrWExY3ucaDNuEfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uNXZK2v0JkN0cn0utryVv3uIgqniUFitDZQbzwq4e8w=; b=V8gZhyz9gIPNkOOuMXUjnPg3/726JKRVcJQN0jQuKNWDn8zKaz+YZ3kIl/q30C3dC766Nf5R7sN2l9HL8ScETmUVVVYRNMeWz5eOxwSoX6DKRP1szgwHWrk92dAybqicml0Um0IK0hpL7mOv8OW46so96IgKAd7P4jv7BcM7LJU= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3281.eurprd05.prod.outlook.com (10.171.188.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15; Thu, 26 Sep 2019 09:32:56 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da9:65ba:1323:a39b]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da9:65ba:1323:a39b%7]) with mapi id 15.20.2305.017; Thu, 26 Sep 2019 09:32:56 +0000 From: Slava Ovsiienko To: Ori Kam , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger CC: "dev@dpdk.org" , Ori Kam , "stephen@networkplumber.org" Thread-Topic: [dpdk-dev] [PATCH 06/13] app/testpmd: add hairpin support Thread-Index: AQHVdDP4dSTDn1Suxkethedwn1cwMac9skYw Date: Thu, 26 Sep 2019 09:32:56 +0000 Message-ID: References: <1569479349-36962-1-git-send-email-orika@mellanox.com> <1569479349-36962-7-git-send-email-orika@mellanox.com> In-Reply-To: <1569479349-36962-7-git-send-email-orika@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a139f216-4d10-4313-8c25-08d742648381 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: AM4PR05MB3281:|AM4PR05MB3281: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:16; x-forefront-prvs: 0172F0EF77 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(396003)(346002)(376002)(366004)(13464003)(199004)(189003)(71190400001)(71200400001)(33656002)(316002)(6246003)(7696005)(6436002)(76176011)(6506007)(53546011)(99286004)(110136005)(8936002)(8676002)(3846002)(9686003)(14444005)(476003)(6116002)(256004)(486006)(102836004)(229853002)(2906002)(54906003)(26005)(81156014)(81166006)(11346002)(66446008)(66946007)(66476007)(66556008)(64756008)(76116006)(55016002)(186003)(74316002)(66066001)(5660300002)(25786009)(52536014)(478600001)(446003)(305945005)(7736002)(4326008)(14454004)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3281; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PWJUEpFy5/MAv5gv2so1d4xe/K0DZpgjuV6MfZGhd2A6FMpxo994jwYkUBLu41KEa83JSt0UhTTHXTmJsh+cRGXH47t8rzH2K/a2+3gQ27B4WHrkGOqcqPqKOZVr8CV4ZY9yqedqFgY+gcX4tPqSb1qyO3UaZFESjS7P3+lFy8n1y+Q5GdsgGqVsmcZOQuC2eODNeDt7h5BtIfMfAq4UKNacUKwc9yUj/OsQJiuNdKhgymPUFwIRgW8bkkIytS4gkyEkq+DWzb3Y/QFIhkaGWlTz8462JK8G77Aokz3Z5jS8nbrDvOUCZCf3AnOmWhSl7jAmCg36ekSNEJKsClRErF5x0QrQPoGF+XLz+XJ/7Z8klRrdiSLI8hmutUe/gqLOaxGb7sL3qqOQ/wZ/9o67z7xqppoV88IgjljvsJ9fij0= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a139f216-4d10-4313-8c25-08d742648381 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2019 09:32:56.5313 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DBLRZf9vYEwcb8zYY3UtoTtryXr0K/8AV4rUoOvuudNWgyIPXBwb82QgWnMbAeVk83KDQ3DupPWDeGX1+l5RIKZH8ro3i6iEHNHurINQKKc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3281 Subject: Re: [dpdk-dev] [PATCH 06/13] app/testpmd: add hairpin support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Ori Kam > Sent: Thursday, September 26, 2019 9:29 > To: Wenzhuo Lu ; Jingjing Wu > ; Bernard Iremonger > > Cc: dev@dpdk.org; Ori Kam ; > stephen@networkplumber.org > Subject: [dpdk-dev] [PATCH 06/13] app/testpmd: add hairpin support >=20 > This commit introduce the hairpin queues to the testpmd. > the hairpin queue is configured using --hairpinq=3D the hairpin queue = adds n > queue objects for both the total number of TX queues and RX queues. > The connection between the queues are 1 to 1, first Rx hairpin queue will= be > connected to the first Tx hairpin queue >=20 > Signed-off-by: Ori Kam Acked-by: Viacheslav Ovsiienko > --- > app/test-pmd/parameters.c | 12 ++++++++++ > app/test-pmd/testpmd.c | 59 > +++++++++++++++++++++++++++++++++++++++++++++-- > app/test-pmd/testpmd.h | 1 + > 3 files changed, 70 insertions(+), 2 deletions(-) >=20 > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index > 6c78dca..16bdcc8 100644 > --- a/app/test-pmd/parameters.c > +++ b/app/test-pmd/parameters.c > @@ -147,6 +147,8 @@ > printf(" --rxd=3DN: set the number of descriptors in RX rings to N.\n"= ); > printf(" --txq=3DN: set the number of TX queues per port to N.\n"); > printf(" --txd=3DN: set the number of descriptors in TX rings to N.\n"= ); > + printf(" --hairpinq=3DN: set the number of hairpin queues per port to = " > + "N.\n"); > printf(" --burst=3DN: set the number of packets per burst to N.\n"); > printf(" --mbcache=3DN: set the cache of mbuf memory pool to N.\n"); > printf(" --rxpt=3DN: set prefetch threshold register of RX rings to > N.\n"); @@ -618,6 +620,7 @@ > { "txq", 1, 0, 0 }, > { "rxd", 1, 0, 0 }, > { "txd", 1, 0, 0 }, > + { "hairpinq", 1, 0, 0 }, > { "burst", 1, 0, 0 }, > { "mbcache", 1, 0, 0 }, > { "txpt", 1, 0, 0 }, > @@ -1036,6 +1039,15 @@ > " >=3D 0 && <=3D %u\n", n, >=20 > get_allowed_max_nb_txq(&pid)); > } > + if (!strcmp(lgopts[opt_idx].name, "hairpinq")) { > + n =3D atoi(optarg); > + if (n >=3D 0 && check_nb_txq((queueid_t)n) =3D=3D > 0) > + nb_hairpinq =3D (queueid_t) n; > + else > + rte_exit(EXIT_FAILURE, "txq %d > invalid - must be" > + " >=3D 0 && <=3D %u\n", n, > + > get_allowed_max_nb_txq(&pid)); > + } > if (!nb_rxq && !nb_txq) { > rte_exit(EXIT_FAILURE, "Either rx or tx > queues should " > "be non-zero\n"); > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > de91e1b..f15a308 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -235,6 +235,7 @@ struct fwd_engine * fwd_engines[] =3D { > /* > * Configurable number of RX/TX queues. > */ > +queueid_t nb_hairpinq; /**< Number of hairpin queues per port. */ > queueid_t nb_rxq =3D 1; /**< Number of RX queues per port. */ queueid_t > nb_txq =3D 1; /**< Number of TX queues per port. */ >=20 > @@ -2064,6 +2065,10 @@ struct extmem_param { > queueid_t qi; > struct rte_port *port; > struct rte_ether_addr mac_addr; > + struct rte_eth_hairpin_conf hairpin_conf =3D { > + .peer_n =3D 1, > + }; > + int i; >=20 > if (port_id_is_invalid(pid, ENABLED_WARN)) > return 0; > @@ -2097,8 +2102,9 @@ struct extmem_param { > printf("Configuring Port %d (socket %u)\n", pi, > port->socket_id); > /* configure port */ > - diag =3D rte_eth_dev_configure(pi, nb_rxq, nb_txq, > - &(port->dev_conf)); > + diag =3D rte_eth_dev_configure(pi, nb_rxq + > nb_hairpinq, > + nb_txq + nb_hairpinq, > + &(port->dev_conf)); > if (diag !=3D 0) { > if (rte_atomic16_cmpset(&(port- > >port_status), > RTE_PORT_HANDLING, > RTE_PORT_STOPPED) =3D=3D 0) @@ -2191,6 +2197,55 @@ struct > extmem_param { > port->need_reconfig_queues =3D 1; > return -1; > } > + /* setup hairpin queues */ > + i =3D 0; > + for (qi =3D nb_txq; qi < nb_hairpinq + nb_txq; qi++) { > + hairpin_conf.peers[0].port =3D pi; > + hairpin_conf.peers[0].queue =3D i + nb_rxq; > + diag =3D rte_eth_tx_hairpin_queue_setup > + (pi, qi, nb_txd, > + port->socket_id, &(port- > >tx_conf[qi]), > + &hairpin_conf); > + i++; > + if (diag =3D=3D 0) > + continue; > + > + /* Fail to setup rx queue, return */ > + if (rte_atomic16_cmpset(&(port- > >port_status), > + > RTE_PORT_HANDLING, > + > RTE_PORT_STOPPED) =3D=3D 0) > + printf("Port %d can not be set back " > + "to stopped\n", pi); > + printf("Fail to configure port %d hairpin " > + "queues\n", pi); > + /* try to reconfigure queues next time */ > + port->need_reconfig_queues =3D 1; > + return -1; > + } > + i =3D 0; > + for (qi =3D nb_rxq; qi < nb_hairpinq + nb_rxq; qi++) { > + hairpin_conf.peers[0].port =3D pi; > + hairpin_conf.peers[0].queue =3D i + nb_txq; > + diag =3D rte_eth_rx_hairpin_queue_setup > + (pi, qi, nb_rxd, > + port->socket_id, &(port- > >rx_conf[qi]), > + &hairpin_conf); > + i++; > + if (diag =3D=3D 0) > + continue; > + > + /* Fail to setup rx queue, return */ > + if (rte_atomic16_cmpset(&(port- > >port_status), > + > RTE_PORT_HANDLING, > + > RTE_PORT_STOPPED) =3D=3D 0) > + printf("Port %d can not be set back " > + "to stopped\n", pi); > + printf("Fail to configure port %d hairpin " > + "queues\n", pi); > + /* try to reconfigure queues next time */ > + port->need_reconfig_queues =3D 1; > + return -1; > + } > } > configure_rxtx_dump_callbacks(verbose_level); > /* start port */ > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index > d73955d..09baa72 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -383,6 +383,7 @@ struct queue_stats_mappings { >=20 > extern uint64_t rss_hf; >=20 > +extern queueid_t nb_hairpinq; > extern queueid_t nb_rxq; > extern queueid_t nb_txq; >=20 > -- > 1.8.3.1