From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0061.outbound.protection.outlook.com [104.47.2.61]) by dpdk.org (Postfix) with ESMTP id 2578D2BBB for ; Thu, 23 Nov 2017 13:17:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wAAmzRVqVUquCXakg6wYxILf8Lj7wIpBlYtwg1p2DME=; b=ICbXFenhGY5BOoGFfPxk4NPfj4eRjcmrliowtcCg20iNg4mwztFLLAgzbN9WuO+L6qsmyhb4yOKCnw5+D422OevLjO36XbxJvbgJ+ACF16wuRI43vRWXA10bq1Nnmw07TRC8YPZOykYWLkLj7u9oMkOOoVl3vIOW+gxhOfci47Q= Received: from mellanox.com (82.166.227.17) by HE1PR05MB3147.eurprd05.prod.outlook.com (10.170.242.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Thu, 23 Nov 2017 12:17:14 +0000 From: Shahaf Shuler To: dev@dpdk.org Date: Thu, 23 Nov 2017 14:14:19 +0200 Message-Id: <20171123121419.144132-10-shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171123121419.144132-1-shahafs@mellanox.com> References: <20171123121419.144132-1-shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: VI1P18901CA0022.EURP189.PROD.OUTLOOK.COM (10.173.66.160) To HE1PR05MB3147.eurprd05.prod.outlook.com (10.170.242.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a0d00f31-514b-4eec-c10b-08d5326c2195 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600025)(4604075)(2017052603258); SRVR:HE1PR05MB3147; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3147; 3:qZqJ2rAY+UQyqE3aD0L8CM2Qjpt+FzDSSB8ENKaZty8rKIsflAXeHmRzDUyH5x7veO+Ra/acZXDld1wE4sGMYTqBQiXJEWn9QABBKr2mP2rJTk5RYrNrYLdg+J6rEaDvzLxdbH6xkQhZ2abKUYW0D7zrzyabWZ7sSzmhRWO2pBtGQPvoysJgRsbxaDIEsvdhh2xAH6sGi6qLTvYoNbXzc34mWXPDrwmxlwttjObE4GgQOjUjU/eii7531+FT6kjj; 25:cjFpjAfPX3rhTa4erwkbgB2ycbPzFJQDAeob+476KaHNuAHAhCWOa3uGzKcLxbpD5C5yh6NTXAEInQ07s/Dj8Ialex7ta/zplyKGYws/KlxKnWC2gEjCxuuzmbaun7PWEqYe4Hs1OLbWrVll6bqI/Sl1tl8XULbatdWaT4182ASY4jGyiATz6gF9dKW8UZaKLl/GIhf962sOlK7+Z8oshuKcWnoFnDMrp5q9V+Fjf+DPowpZs02zXfGdusdbPZ8SIVv3ysKTkUQmkEMGtrOHMcQS2toq4keDUxAXx1l8/OW5WspnD+3PZsihQX5dMmvI7bgwkVwBbYGyEsdBmuQI0funwtQVvFLrx5+7TV1hkhw=; 31:SBcvJpOXNeNV2VChV7MscJhIZDXWcHLXpu/TFzbPsLWGRsJvc0TZMOk7z+ncQ56V3jHTLtPHB//KZjlH8v4V+8pg83fEpifC+k+PK6gGWOq0jYkxL8k7L10haPGTCAinHGAw6BqJ4lvWUS2pGVlSYGMXKDJ0bNs3f5Ehty6BFZS5Cdx2097vHhOTgdw6xEtCcruPxnUJ6A54q8wZpzy2HQ32On/tFsvd8YyEav9QGF4= X-MS-TrafficTypeDiagnostic: HE1PR05MB3147: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3147; 20:gXZwoJWZ05vQ0/vfidKNR5zQoG2vX9QuLrpPD1pPIETWFcwu5dMUQtIZGZeMSiWc/uUwpm8NDpq4czM71Z8Ed6gHNJ24LkVCuCjDu5k7H7shZRgxgwjS4g7UQ29jUMGnfJjE1Wv+YycJT7Z/u72gY5Gwoshnux33A5REriCOcgjZvePtTvbSSVYf3AbKriue7vBo+NsetAgNIa6HViQZhvQbzrmM1aQ9+Tx4P3e03zm4+FDklm2K9HOmAO69MsmVVrTK6qkjg9ACd1hj8Fpd+C1yPucMl3nWlfwZK2d0RiWiIsohkDpJjxjXCS6pC4ohZOnQ3OwYSciv7xf6yo72m2IvuD04zQQ+HCrTg7j/GZqW4BouNzcJt99suGzeL3fzgfaUCS5qqkBuj8gsyf7nK9wpEteGjnoDmSyBEuDZoGwX1jqmZ4dn0KJtnSDIY3gz7HT4f5CK5KBieNSyVFydt8oF5E4ujNAbQlLDwhH5gEkGf2LOX/jiGOECn/3V9RfA; 4:Bkj4aui3avW7b3FoVvH9n8QQZlO6PC7k1S8H+3UuTgu9NFfMxAIcvXQ1/u9j0lt85vuOkRToA/PVLaJtRP8nwJOFXgnd3IkKkrT8DXDaUhh4Xd3/RaInJD0ebMr67Z8t5H6mWig+1yjbrwsna3IPDnNsx9A6u3WfDOdj/1ojYw/hmZ+LPWuZNuxLD4ltVSFQEGPKir15re1+Eq0rVjciCvA0UgPu6mBlqMfC84tEoBfA+ls4d1sUM9qjn7fbhwocTcua+1n2dN7a2WEvBJ8y/Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3231022)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR05MB3147; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR05MB3147; X-Forefront-PRVS: 05009853EF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(366004)(39860400002)(189002)(199003)(106356001)(50466002)(2361001)(7736002)(105586002)(76176999)(55016002)(305945005)(2351001)(189998001)(101416001)(97736004)(2950100002)(5660300001)(6916009)(69596002)(33646002)(50986999)(48376002)(16526018)(2906002)(47776003)(52116002)(66066001)(36756003)(21086003)(33026002)(25786009)(16586007)(316002)(81166006)(8676002)(81156014)(3846002)(6116002)(1076002)(5003940100001)(478600001)(50226002)(8936002)(68736007)(86362001)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3147; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB3147; 23:UyKKN4a/4T/Wi0Vg2Ps3SbGkfsksCyIGzDU6Q+xGA?= =?us-ascii?Q?G4qJKLg8OaEPbI6kWYKvQXFhzFqFG3I8urHbB48MuVSvu5A+yA+El2dEziNC?= =?us-ascii?Q?IGg5fsERqOxx7Y6imfN/JXfhgmk4UTVnqhKSqBlD4jeIkzWY6sxxvL+6z9Sw?= =?us-ascii?Q?/y2XRoQgjMqrBDc0W/Car3sm6Fr7Vvtj7ADamKjOnhthaXAkR0TTWEVM5rJ2?= =?us-ascii?Q?JfEgrLiL9tIsyO2Lj+7JAjDC7EAOJ/Torm/VLQ3HvFeURA02mEO0H7Jw1ufz?= =?us-ascii?Q?X/zHKi6rtvqezQeql+Uh9jEPVO6ZlCEUQl+xbNXfOQUhDieD7tFEG9w5TMaW?= =?us-ascii?Q?2sktaeB0bSstymuj4nR00CAnjdAl8QbE/50UWeY8zL2761dQW3rXC0+BIh8N?= =?us-ascii?Q?yu0kYuvUxhWmsNC/QcaBS0opOYfcHaxbdsXmoD9k3VU6zPRTTb5p3GPq/+3P?= =?us-ascii?Q?vGP+0StEUBRZK7DZt7iQf2tIDqy7/nPJpsev38WWcJKyDyJvt/xPYUL7jabJ?= =?us-ascii?Q?c87eMjWLjkSmsrOYvxTk8QON5GrTV15zmsz4A/lUHUQl982Fz8b2eH0eP6pm?= =?us-ascii?Q?iBlDZfnEHFiIUbBElWjKJ6uZNgoYpJu33c0fVJvtJHoQl8MgV39JfMGUrdkU?= =?us-ascii?Q?Y2qM38a+bNOinNgXJxiX2kK+mAWyupxFHMZbgDNbFFZpc/u9OWrZyc2XX3uV?= =?us-ascii?Q?KexNRb9j2rQCrWb+cMiulO1YhqEt0eNFCKLzzt4YgSAOezP3EPR3BziTTRYH?= =?us-ascii?Q?yPV/a8PBlfg55mB6b+g6bQuHQYM7G9w/R8gRL5i+AH1BH0sf52yOA9s27b0I?= =?us-ascii?Q?WuU6JZDHKvY7aBAkJLiBfOwo8ZIaQW36n+xnVJgjW6oiLi0VxBw3K1b96SFI?= =?us-ascii?Q?2ZQOoUHd7lBl8653g2cx+Vgj51g/so5vcUbFaV0YI3vD7VdwPxkysaBGrjZD?= =?us-ascii?Q?dvrLyswDgtbZmMjilXF3M6Y0KwS2CbJv6KFNsYzYewGhDR1+l8IIUMeNA3Bw?= =?us-ascii?Q?thBXWC/rzUpzPa315yfBVSsxbTsYUAEYBGSfMsvH4M7dJGl9Q8pbjtSF2CBp?= =?us-ascii?Q?IerkKV/diFQYZBuULDMGJFOOvimNEq28QLxIV1s+Bc9CSmAGxHxun1LkE3vC?= =?us-ascii?Q?pCADpvXNGSTu5t+a4jv97co3AxULrQ3mOQpb6rbYNzwC6tjG8whcrHRlmyAr?= =?us-ascii?Q?63lsdq830jV2qY=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3147; 6:Uk+06sK3WcDFS3LnvP+8Ku8qusCtZtspSB6yEQUXeJprlcNLz2qEu+DhSiBk50+dfvLX8pmUNYRbRpPdq1K7apa/ZietL98q09TbDqBYCYKguFB3x4ii2SKv7+nfy20ku2BPwwTF9GNjoGBXbpCV268v3ERtU94kxO4m1VDzkQOUmNZtcHkNGPXl3rJhntW7QRhBbtjKlgqEZ29jifVaguYHEW1S/8ctH9sBcC8nAVoXD8i5nQGkrYxTz27zmSEsFCKb9EO0vwB3p0AdFcj+jdZafKF+xALINqADeIkHxbfq/CWX4h9mri5vIAQx+6cghqYO3TmGWOR3m31uusmtfR5SmFU9LE4anN3GbUVJdFY=; 5:0OvBjXtawEhHh7BTFc7KOv1m15GHaQoxHmuRhD8bk7PAihrIPn6toQ3J72XxEpyov0djN/UHqcMtkOerBedW2zdtIOoI3nTh6F28kNx7slL1nBUl3vi2NatIKMqqoQoMUOhOT0TwKfGOcBenSXXXUpH+7thBhapN3CEWUtkXoc0=; 24:pS3uRTPmIa8A0Kf6e+04m1jee1SgqqRbWvqXoChbWJmZ3I0a5FNW2BLat6RkullbwegBh9+Bi5ol3mf9J4B4/rjBcxbkQv98h6C96oI04EU=; 7:RdbZZeR9sDmt5LJ8h47gstgtLzheD772CizmsiS1zNF2M/Z+7fH4OcGXx0QV8mG2FeJlKSQcg3+6XUI7TyGa3QUTYaxMnjaLyI9OBw/5pkv5mXOY1nWm/aUGTQzSM7+PjzJLUNg0dA8kBODe8VoKcgn8eUU+mWzr+OcUOKBjjiNNN5XY31TM9MNx5UOxfythM0VSyLfcORvLftI5nNurdFwM05uS6LOQ3tGdhtfQbS039HZYUlUsgE4ZTB/UeFUL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2017 12:17:14.0206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0d00f31-514b-4eec-c10b-08d5326c2195 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3147 Subject: [dpdk-dev] [PATCH 09/39] examples/bond: convert to new ethdev offloads API 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, 23 Nov 2017 12:17:15 -0000 Ethdev offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new API. Signed-off-by: Shahaf Shuler --- examples/bond/main.c | 68 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index 8e3b1f340..306447e6b 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -151,11 +151,8 @@ static struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_RX_NONE, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled */ - .hw_ip_checksum = 0, /**< IP checksum offload enabled */ - .hw_vlan_filter = 0, /**< VLAN filtering disabled */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled */ - .hw_strip_crc = 1, /**< CRC stripped by hardware */ + .ignore_offload_bitfield = 1, + .offloads = DEV_RX_OFFLOAD_CRC_STRIP, }, .rx_adv_conf = { .rss_conf = { @@ -174,10 +171,30 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) int retval; uint16_t nb_rxd = RTE_RX_DESC_DEFAULT; uint16_t nb_txd = RTE_TX_DESC_DEFAULT; + struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf rxq_conf; + struct rte_eth_txconf txq_conf; if (portid >= rte_eth_dev_count()) rte_exit(EXIT_FAILURE, "Invalid port\n"); + rte_eth_dev_info_get(portid, &dev_info); + if ((dev_info.rx_offload_capa & port_conf.rxmode.offloads) != + port_conf.rxmode.offloads) { + printf("Some Rx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + portid, port_conf.rxmode.offloads, + dev_info.rx_offload_capa); + port_conf.rxmode.offloads &= dev_info.rx_offload_capa; + } + if ((dev_info.tx_offload_capa & port_conf.txmode.offloads) != + port_conf.txmode.offloads) { + printf("Some Tx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + portid, port_conf.txmode.offloads, + dev_info.tx_offload_capa); + port_conf.txmode.offloads &= dev_info.tx_offload_capa; + } retval = rte_eth_dev_configure(portid, 1, 1, &port_conf); if (retval != 0) rte_exit(EXIT_FAILURE, "port %u: configuration failed (res=%d)\n", @@ -189,16 +206,22 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) "failed (res=%d)\n", portid, retval); /* RX setup */ + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = port_conf.rxmode.offloads; retval = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), NULL, + rte_eth_dev_socket_id(portid), + &rxq_conf, mbuf_pool); if (retval < 0) rte_exit(retval, " port %u: RX queue 0 setup failed (res=%d)", portid, retval); /* TX setup */ + txq_conf = dev_info.default_txconf; + txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + txq_conf.offloads = port_conf.txmode.offloads; retval = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), NULL); + rte_eth_dev_socket_id(portid), &txq_conf); if (retval < 0) rte_exit(retval, "port %u: TX queue 0 setup failed (res=%d)", @@ -225,6 +248,9 @@ bond_port_init(struct rte_mempool *mbuf_pool) uint8_t i; uint16_t nb_rxd = RTE_RX_DESC_DEFAULT; uint16_t nb_txd = RTE_TX_DESC_DEFAULT; + struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf rxq_conf; + struct rte_eth_txconf txq_conf; retval = rte_eth_bond_create("bond0", BONDING_MODE_ALB, 0 /*SOCKET_ID_ANY*/); @@ -234,6 +260,23 @@ bond_port_init(struct rte_mempool *mbuf_pool) BOND_PORT = retval; + rte_eth_dev_info_get(BOND_PORT, &dev_info); + if ((dev_info.rx_offload_capa & port_conf.rxmode.offloads) != + port_conf.rxmode.offloads) { + printf("Some Rx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + BOND_PORT, port_conf.rxmode.offloads, + dev_info.rx_offload_capa); + port_conf.rxmode.offloads &= dev_info.rx_offload_capa; + } + if ((dev_info.tx_offload_capa & port_conf.txmode.offloads) != + port_conf.txmode.offloads) { + printf("Some Tx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + BOND_PORT, port_conf.txmode.offloads, + dev_info.tx_offload_capa); + port_conf.txmode.offloads &= dev_info.tx_offload_capa; + } retval = rte_eth_dev_configure(BOND_PORT, 1, 1, &port_conf); if (retval != 0) rte_exit(EXIT_FAILURE, "port %u: configuration failed (res=%d)\n", @@ -245,16 +288,21 @@ bond_port_init(struct rte_mempool *mbuf_pool) "failed (res=%d)\n", BOND_PORT, retval); /* RX setup */ + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = port_conf.rxmode.offloads; retval = rte_eth_rx_queue_setup(BOND_PORT, 0, nb_rxd, - rte_eth_dev_socket_id(BOND_PORT), NULL, - mbuf_pool); + rte_eth_dev_socket_id(BOND_PORT), + &rxq_conf, mbuf_pool); if (retval < 0) rte_exit(retval, " port %u: RX queue 0 setup failed (res=%d)", BOND_PORT, retval); /* TX setup */ + txq_conf = dev_info.default_txconf; + txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + txq_conf.offloads = port_conf.txmode.offloads; retval = rte_eth_tx_queue_setup(BOND_PORT, 0, nb_txd, - rte_eth_dev_socket_id(BOND_PORT), NULL); + rte_eth_dev_socket_id(BOND_PORT), &txq_conf); if (retval < 0) rte_exit(retval, "port %u: TX queue 0 setup failed (res=%d)", -- 2.12.0