From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0050.outbound.protection.outlook.com [104.47.2.50]) by dpdk.org (Postfix) with ESMTP id 9A4DF1B23A for ; Tue, 12 Dec 2017 13:27:55 +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=Iam7rFdYK7At/KBV2PBOWWj7gWojAbMxozxiUasAna0=; b=IrgCDsrl48Z/+Qpfe76wjsClILSW/Gl0BDU3T3T9yeMkRNGOEPnyN1HDuakZvwy2KhGmJ2WBcw4cVNAH1Pn5DMG6s2Gf/mEx/DH/sEG2HSXZvPsRag/8X38xe9iKk43RpwsdNNuEzNDM6e0VckrWLr1ajYX5IpyN4NT1nvfrzlw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by VI1PR05MB3149.eurprd05.prod.outlook.com (2603:10a6:802:1b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Tue, 12 Dec 2017 12:27:53 +0000 From: Shahaf Shuler To: dev@dpdk.org, konstantin.ananyev@intel.com, radu.nicolau@intel.com, arybchenko@solarflare.com Date: Tue, 12 Dec 2017 14:26:39 +0200 Message-Id: <3bd06d43d7e2a36566beb4f98752200366d396dc.1513081088.git.shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: <20171123121419.144132-1-shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: HE1P191CA0010.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::20) To VI1PR05MB3149.eurprd05.prod.outlook.com (2603:10a6:802:1b::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21d9ed3c-1db6-491e-f45b-08d5415bc4ad X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:VI1PR05MB3149; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3149; 3:+ReDKvBUphWKVV6luHNHrmyoN3Na4U4y8PlF4ltI280qU5z94O5yisUXgMRF3pPvHNnu8H/xj51DebzK+3ifBm+JHZ/4ub4kiFCvBQGEapTf/2PhN+7VmDBmwdsoFIkLnnQQ9Kdvjah+LRuoNBtB6P1xTL4uCpNaiw881fnbGeZFP3fhFuZqeBh/+i04mw5RNGyxDkLAoRjve0uDT/rTw+bmUe06c646S4GWMl052kWcp2AmydG92YWkCZs454QP; 25:MvVvrXGRIbZqeJAdetTHw+PM/SqoALfWqEzn7vFbty0GKOSm+jReRBtXx6cPEL77v7RXppTPY27slcvBoYIY1oL0RgrwmTa8h/ef17Vh2kd+NpmVDwDyTFi2E/6S5qODyIFS/2QCHvcjdj1u5tGe0rKGCxPWmflVIsr7v68sWIgq1pl1aRBzqG3SEDDdn9/4q7d+F8sn3finUsaspB7cma+1sTeN97+3Zym7rRkpnWpsr4guk3UKWXdgdn2T3kgRn1bQ9MNtWy/IpvjMk9tbBVRNfS0Y/H0WPywsCG8VAFucdrpnX3y5mnMKkdWlh3aLgtO5mv4zXExYhukIUFkdeg==; 31:zSRZRW5D79FKFApicP6dggbRzKdkYY1JEBfqLMZA370RmNoaozBpLKT5trB2hGnC4lukCU2WJ/fIurZkf0mJOgDVoDAYrbRPjEVXQRbi39u3opZrl1Adr37tVO+a3mSuFZOcC9RHuz2ktcJ3IMxeSjSH1gUbWLprhDXFM9Ym3a4b/qCHdH7w2IBfpry0tlrBVWzmPZgGpMKqOVGhMbOR1wgmM8C3FEx0xbYijfjyBT4= X-MS-TrafficTypeDiagnostic: VI1PR05MB3149: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3149; 20:Eioc7NJ7m9DWVgXT/uoX7mf/43FA0lH+spWrsIfQWoi5R5gbF3CK5f3buZsq9fRp+CK93JDpmybTNww+swyawDNUJG6/qOOnCRkcbje6l1CsQTqr8jXwarlyWCGyE9fx84juFtn5Ykenac8KrHteGoa96yTYQOxOAXeAsDxw5uHEMlJOAPz/Wmhf36bFRe2Z2hzPGaca0zE0EWlAZ8QcdXf0rU125q8LmXQHI175D6KbU0G93v4CT29lOZrcymjKjjon/XvrGx43W/wth1vm3mhUn9m2gfRgS2ua2mgLGDDZ5ov+YJFA04lkIlhAEpoT6IC449G1p4jF0K0T8y2AlgvmGqcJAoOWG7hk4POAFWcNCtprdKiylcRXEwcDjSoIMWpPkSgiilwSz1a7edY1YtxWv8+3/dvkqwkpmk78E1oBnXqDBjSK8bjcnSQBndcHfVGR66IzARW/P3fZiiVFLyuqStnKwgqlmjwfhomg2TUMfKNBdI73db0TbOfypDgT; 4:Ik67rLriSx3VF1ZvHaqKlJLFmix5V5qxXmg1N/A6skRSNz4fznxQcgudlTY2J52+5NPfk5GaHkdX0svqyZqR6G7vXcGxg/t/JiTzRkgFTIxilogFMNL9s0VDkpxVi2kJZ1E2EmOxmw1x8GWGpKBH9mhcX3IK8EKf4u1dGb44ovwjfEZLiOfEKKrrGHsnlxdDo6IcxYMw/1Sg6Va9Ko+86yOO+Zg6GhWKygdLzq8AgSC5k7/oG9LSgiT3zdm6GxQjXkxayFC/EGUtOpW57zIkfA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231023)(6055026)(6041248)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011); SRVR:VI1PR05MB3149; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR05MB3149; X-Forefront-PRVS: 051900244E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(366004)(189003)(199004)(7736002)(8936002)(305945005)(66066001)(3846002)(5660300001)(47776003)(6116002)(2906002)(69596002)(68736007)(48376002)(33026002)(2950100002)(50466002)(81166006)(21086003)(81156014)(6666003)(8676002)(106356001)(105586002)(118296001)(97736004)(478600001)(51416003)(25786009)(316002)(52116002)(7696005)(50226002)(86362001)(55016002)(36756003)(59450400001)(575784001)(76176011)(16586007)(53936002)(16526018); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3149; 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; VI1PR05MB3149; 23:qxG3DsZ4vovljHmWXMNbn33JLjJOMivYYGpZpupc6?= =?us-ascii?Q?2VwICHh96/wsTe1LcF6ZVenIs5aNRApUGmNAXV0Wf3reSgUQYGS5e95XuTRS?= =?us-ascii?Q?kXzTkzQvcxqvQWLadDQ3WlvasFuhaye0bX8gJS2FIT9aJXgPuHhuUyx8wF2B?= =?us-ascii?Q?ZRGHwtFXYJHXTkoFkR11JCxZn/CCkxXxUCVJu30KqZcXCcT9UcR2DohYkX0s?= =?us-ascii?Q?ORF7SgnOoh3UbsCkRm9Sl5h3Pp6LfRmvCbfTKJMpLDFcNKZXxEh8diwfHM7x?= =?us-ascii?Q?ohp+6u3xmItDa+Q2D6aHFIK5F7GKWDdzSOp2pAN40Vi9mGEtX5Xf2g+jZV8x?= =?us-ascii?Q?WLAgfmFKPXLWz8T1zsfv4F96Awb9GglZdAmWQlouvUF2zWTEoykwch9Jsw9L?= =?us-ascii?Q?5qjju/gN7txxZTOaZxIStYJOhGfRuWW1KUZ7BeLPuwJh7v4wi1ZdHTKIzYlS?= =?us-ascii?Q?8z1HLMCJCKwM+pXQHDsvk3gOZxBcqb6Q0RPI2CPqcyJRO6KNw7aZyrQnTXxD?= =?us-ascii?Q?kkEiV2eARHfGCNZg3qmPZXHaQjbl07aPqW62Un1/MQRvhwPWfdSvgq+mECSm?= =?us-ascii?Q?B+G9x9Yof8O5MfojsUuiUP0bwolhUGRgDLisyRLn8GbrffA+vief6r6de0wl?= =?us-ascii?Q?CPetktRs76tQ+JnyemCtN9/l8armzVlFps82IcSi9znQdaoUxCogzwyedPKN?= =?us-ascii?Q?pr1guj8Kvp6NipN4PKljD30q2wuwBPWnwAlVN9UHBXTjdLrFA9nEknSXkrik?= =?us-ascii?Q?dIl118OVKYa8qmeUXi49jTqmhr46J3bn1qa3Kb5LLbET331QkuV90d5cRQeY?= =?us-ascii?Q?xOqLNsdRYyvPGiaOl3LjFJiTHbE5RsQR2wXsseAoUpwjcx/vyV/lk0TNnqBY?= =?us-ascii?Q?9/XNZc1hsk60aGiYkHMYpv4JAipENELc4PzFY2ojCkyhqveRHPlSpGDAmKWC?= =?us-ascii?Q?QFabWEkM2EzL3pTXElVBud3ECW4wi+u5U4u913QZBjSXUp1sjgmQT7joW5Gb?= =?us-ascii?Q?LsYdoEFecpTIzLn3oOvVVtlfWsbPQbRmOLFMtDO8T1QVBWv3/4A5ShIW77jP?= =?us-ascii?Q?gx05YT8NzcK2f1vf9Xmty/BkeD2JSY6U4jCjlTCRy7Ndbbuxg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3149; 6:TbGhxCgAG6+UqcLsqWyFwiRrP2yn1PSW+HyyHKrMupNE6rfyMaiFaahxpp2Z5JM0VHZJs/7/qqr9Bo3gHHMXEhM0bamWXlWk+d96mhWvQwc0NqZvFgtcWPDuNtYZ4wZ5NJKA3SeUcdz06cP8MvpM+fIXVQ1E93lC8niz3JIITaHjurYEaylJYTyfpYw3k/Bpy3kpCysFfaSLC2SI0GvOMjzK+x8adpUNS21O2HWi1yhwoCskXgyJrQzylpclSKQUI6HVq2K4K1tlVnLPMlaE4ay1fLYun1v/iCpI+qCyLLSTHw9ksyLJL+HY9LPNfhfnqDFcZR+LGQFEfHzHW7EURnXq0nQXRbdpKsOm0behjOU=; 5:++cmPktUKuVrGxP9YCKMjQvx5tTqwo5P2ZxJsuyFDMQoB2oYunTZTWZRa4Se1do5HGGneQfkExUC0FWYjdYu5fJ/DcEymKNjhJNyH/Of3ppFWf4ndZtyBKY42+/gyustu2zGpGB99CTUQPeXvoMmbKqwvoW55YPvaVaizXK9MJQ=; 24:SxgY62XdzBE4RVpnYn7AFu9oZwzyLi1UVQMgO290IR3kLDHL10WTr8LupxHGjUxdzb79M/cZCto6e4l9xHXMb5xnE+m61edC4arIrdmyWOE=; 7:8SEyvXBpwEhqkEVhO7hIkY1GAhO9JrOIpkdPR9ad76ZhrW7t+gwNfBTdXyoAw5MOoVSNLBjchBXOM0+zqQcAxznr74T3TnaLEKpI+CQreefJimyDQ14B/47oLXvPzT2LZ4rNx2rfSivUirIcWPluOB+G6RmhCWwfctZiOZP+MPcksLCtjqgPWvDGeKyf9LO9r5/zRGlRpzfMEoORIzxG7SpA4/ePyP5tR6Q84VdfLKVgNZyp0K6VtxH5euA3LXQj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 12:27:53.1707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21d9ed3c-1db6-491e-f45b-08d5415bc4ad X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3149 Subject: [dpdk-dev] [PATCH v2 22/39] examples/qos_meter: 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: Tue, 12 Dec 2017 12:27:56 -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/qos_meter/main.c | 61 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 67b4a75..5b0e3ae 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -85,11 +85,9 @@ .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, - .header_split = 0, - .hw_ip_checksum = 1, - .hw_vlan_filter = 0, - .jumbo_frame = 0, - .hw_strip_crc = 1, + .ignore_offload_bitfield = 1, + .offloads = (DEV_RX_OFFLOAD_CHECKSUM | + DEV_RX_OFFLOAD_CRC_STRIP), }, .rx_adv_conf = { .rss_conf = { @@ -99,6 +97,7 @@ }, .txmode = { .mq_mode = ETH_DCB_NONE, + .offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE, }, }; @@ -310,6 +309,10 @@ static __attribute__((noreturn)) int uint32_t lcore_id; uint16_t nb_rxd = NIC_RX_QUEUE_DESC; uint16_t nb_txd = NIC_TX_QUEUE_DESC; + struct rte_eth_conf conf; + struct rte_eth_rxconf rxq_conf; + struct rte_eth_txconf txq_conf; + struct rte_eth_dev_info dev_info; int ret; /* EAL init */ @@ -335,6 +338,22 @@ static __attribute__((noreturn)) int rte_exit(EXIT_FAILURE, "Buffer pool creation error\n"); /* NIC init */ + rte_eth_dev_info_get(port_rx, &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", + port_rx, 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", + port_rx, port_conf.txmode.offloads, + dev_info.tx_offload_capa); + } + conf = port_conf; ret = rte_eth_dev_configure(port_rx, 1, 1, &port_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_rx, ret); @@ -344,18 +363,41 @@ static __attribute__((noreturn)) int rte_exit(EXIT_FAILURE, "Port %d adjust number of descriptors error (%d)\n", port_rx, ret); + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, nb_rxd, rte_eth_dev_socket_id(port_rx), - NULL, pool); + &rxq_conf, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_rx, ret); + txq_conf = dev_info.default_txconf; + txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + txq_conf.offloads = conf.txmode.offloads; ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, nb_txd, rte_eth_dev_socket_id(port_rx), - NULL); + &txq_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_rx, ret); + rte_eth_dev_info_get(port_tx, &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", + port_tx, 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", + port_tx, port_conf.txmode.offloads, + dev_info.tx_offload_capa); + } + conf = port_conf; + conf.rxmode.offloads &= dev_info.rx_offload_capa; + conf.txmode.offloads &= dev_info.tx_offload_capa; ret = rte_eth_dev_configure(port_tx, 1, 1, &port_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_tx, ret); @@ -367,12 +409,17 @@ static __attribute__((noreturn)) int rte_exit(EXIT_FAILURE, "Port %d adjust number of descriptors error (%d)\n", port_tx, ret); + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, nb_rxd, rte_eth_dev_socket_id(port_tx), NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_tx, ret); + txq_conf = dev_info.default_txconf; + txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + txq_conf.offloads = conf.txmode.offloads; ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, nb_txd, rte_eth_dev_socket_id(port_tx), NULL); -- 1.8.3.1