From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0086.outbound.protection.outlook.com [104.47.2.86]) by dpdk.org (Postfix) with ESMTP id A4C591B3EA for ; Tue, 26 Dec 2017 10:24:27 +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=N0al2Wz1H5o4yT4YYcJaGvwwbTdz6hBTeN/irO6hwEY=; b=X7XNhdlL1DVp+aF8bJlvl1d9o+irVI3TDgj/eYiYp4CZ636jpohMjtVfSGMpG9rWfvD8DKjDLKS9TbMIUTPIeBHbrO1F3M0R1jdpQ8qS0eECYJeKHLnnnNmVbvqF+z3CPZ964XLP0SIzM2b5vbAX1bgwCr/Q3iREGnaoF4+mPX8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by HE1PR05MB3148.eurprd05.prod.outlook.com (2603:10a6:7:36::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Tue, 26 Dec 2017 09:24:26 +0000 From: Shahaf Shuler To: dev@dpdk.org Date: Tue, 26 Dec 2017 11:23:10 +0200 Message-Id: X-Mailer: git-send-email 2.12.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: AM5PR0102CA0023.eurprd01.prod.exchangelabs.com (2603:10a6:206::36) To HE1PR05MB3148.eurprd05.prod.outlook.com (2603:10a6:7:36::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6021936c-1c62-416c-2b56-08d54c42759a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(48565401081)(2017052603307)(7153060); SRVR:HE1PR05MB3148; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3148; 3:lOSPupRNdSHeSFurwMlIBK5P7GTuVC3actiquPtdkRT7Q61vzakbq2sZz3FfmEiKaRR2sVUPjo7dSISOcRZ3J25VF37WFDeandZ8cCvXk3HtvzjqJ6t+1eYU+RUBwu1SCbAf8GUHLC7X6jo2TLHhLrGq1l9sR9TJ3h+65g+EGgOYRJcQq6P/ycaA1w71pe6x50hl4z6/Ph9M1JW2sGCgFzlLTUAvxMuJYnuRCsxxW7gAGawn9ZBwV/CRScEf+sgh; 25:XtqvQiTKuq4uKGd7ffYkcnRy0mpWf0Q7e9aiDlbYbCxLd2Koh3eaHpJ1gFDaPb443BudObETpBitkq+NdRRQVBHROw+gA2f7zQCM4EaDZdnAT7fkLoGEQWNtyfxsqLDQ562L4YU9m4E5tpxkRSDd7c8zLKs+HOEL2Dt20d4Aey7AgWX4jdsXWMuUpBXxjcQ3gCFayEfMct1yWy5BA0PWfkP4/Rm92gNhXHJDW9yM3LgXMoe5ducedoHjHZnLolJfR8KOE5wepsG+vnNA9ApeauGXb4qHKSBUsDvdBkmxq4ldmoMjSJFjNmhEIIaU4nx7PvpYt08rCsCFaeZBG7LkjQ==; 31:FCY6X/CtT/lu6c590uBH74gw+7yKROFu2+VTxuOTzElG/v04vDKjeq9RMpR39BOTHAHVzWfD24xo5ii8lAYbfWF6hwBFmfo2Dp2/qkWmrsJkgQz1zUFSJK3PCLJaGW/rcptNcBqYoGb+1ZjYG5+wdFKVKPVrO4jzA6k+tPWZXBalk/PlqTMe6i+OFXMG2rCM17lXSbCnoGCvNt4MAwe5i0jyWXHMiXlBHjTbPslEmGg= X-MS-TrafficTypeDiagnostic: HE1PR05MB3148: X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3148; 20:GhaiPY4NeF8IzSNimb7Rz+d4QyyGWmA1bPSj7HKUcLYNQ1F9kcy2QVFWpXGFaUQCH72wylIGOQoELt5hyC3qpI85PWJWpaVYAG10Q8SsJRqvnnRD+6tlSGW8XKFy9IfQ1APGrXMsJoplL5KHpfs/6dEnuKKmdRi6nr2BAl2rgUDgx0THCGNNFr3HCy2tfRkJeKWBG/Xi73j1mTPVmXP13en4kp1aGGCePoPog7DJrVnzxgyjumpD6D3pkcGG/DtRVyloywr6Ib9CZkZYQb/Ut8zLV185ulKYEUHW7/BUL/N1tI5btWwhg8vSslawA5qN7oM8j6M2U8ErJwGY0EUINNHiE6aptNvvFScgLvgDYwUWZp3hLNOCl8UhliWiP7BCijvva9XZktKnU+fduikU56eWgBdrIy51fGUetxggDbg2lThN6xwy/M/75iwaJI8aIi0P9tDCs2q2XiFIHWhik7my6HR3XrG1lLWah9JXeI4MOiPartEVn5+24B2F9MJV; 4:QU/HjrcvpBwqNV2fQPh7Trr2QBkGlm1iVAE7qNua/yfDSiMQCsbORQn4hkjdwbS/TiZLr38xteJaooGhvhpIgQmVSJO3GtUSMdL0dVGW8zmFhbyp9YKgi8bq183nAx7OIXs9U96hY6O2pYcPH1aWHv5bGGzGCHEkyJdL9SL4L4DnKFWye6V3F+8tN7wZYNBRS6v0V0iwQWpmL0SYmoTad07bPlbM1Py9cJvWRHrECk6Zj5mwxzu8CiKktpyDkuXK5YAwqQoHA/Suql3sj+275A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231023)(944501075)(10201501046)(3002001)(6055026)(6041268)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR05MB3148; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR05MB3148; X-Forefront-PRVS: 053315510E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(366004)(39860400002)(39380400002)(376002)(396003)(189003)(199004)(316002)(6666003)(55016002)(105586002)(478600001)(106356001)(69596002)(16586007)(51416003)(7736002)(48376002)(76176011)(52116002)(305945005)(50466002)(7696005)(2361001)(2351001)(33026002)(8936002)(25786009)(5660300001)(50226002)(118296001)(66066001)(47776003)(21086003)(16526018)(36756003)(6916009)(86362001)(386003)(59450400001)(2906002)(97736004)(53936002)(68736007)(2950100002)(81156014)(81166006)(3846002)(6116002)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3148; 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; HE1PR05MB3148; 23:zCJPMsLOgJm6Y18OnnGVi9vvFXzf2AWLJTukwxPr/?= =?us-ascii?Q?f/MxJ1WbkPcTN5l3JqVahVn/kEc0i9gWnwqmYe73jACco3fZntKMFvQyP9Fv?= =?us-ascii?Q?XKqrgBWh85HiNqmZpmeIlnbTNE0Sv9wWj/MuQxwUfKXkrATfJWjEwLOqRYO8?= =?us-ascii?Q?2+PicgjDJr2iQISYtF1fv6JOqCB8jH554KrKVbqUB/ZDuir9eDAXDfkqdnWo?= =?us-ascii?Q?WFZa7TIRXpn34S/oh2BPGdkqLlb7OdxmOJwh1wagA1ihOkz+Bsff3vVG3Kd0?= =?us-ascii?Q?NABNHV73sJJAVBMt3d38zjYTBgLckUMUBtbZbMM3cMaMolkO6Tx6AU2aYxaT?= =?us-ascii?Q?4Uv2fTZD7WLOYKCWcF8ILM+3pcmhkotfP8a+xzUKBiZbHkOTB8P6RKTKI7nu?= =?us-ascii?Q?7t8wdAiWi3UEwhPUSVgrSaQevf+z7tKkMqwmdiNBEh5mk2xJoNEvyYjJgH+S?= =?us-ascii?Q?gZyuwPc5Vmqkl3meyMeKG3yb6asmV1dA4oJYoLBURkiIuoD3zw8YQPF2ILz2?= =?us-ascii?Q?wj8OcpbhW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AQ/hMZfJJOPy8phU47K6RXbghH9pa06VDiBuTQg0+t6PXNz8sTW+VAXq2VmJHS2Uop7FAGMpqSwOC4TFWGGn+Dw0/pShYRCVpvmLDOCainkmyKhmK6/uU8pjfxChv5PNgVC5rTpE88ozMVEvepsc/UPFmcQ=; 5:y0zo3Hhzj3ERAH56fAr8ywt09A2ZXv9FXUKw3SyHM6EqArWOc54q5bqND//nkTJoUblsDp+1Us/uzyObJbrIEh5e85ITIJ0UE+ynYtJWV6vX8xonwoNtX5TvzayuPSBn+yx5yl92vr/8rYlWMWw+p/sRW2X56XUzQlkd/oMdJPs=; 24:v/ZZD2xFj2HJhON5SyuBF/LXRBru2kgsq8bpzDoWXmDU9U28ImKaZiztJ+2NX+Tyyrbi8I/XQyM8HFRlMA/UOAeKcQ6ZR/v5CxguzW736gc=; 7:RUTrGJcIwcEScEKr0QjtihP/EbmPBIGY7qUyFcitKSUtVnlHticH0cRtzwLGjnO46V5mMpufAqo7707U/s2r4NSDNnHowTMovHQkB/x/uRiWHx817/b1EHcebNP4d60GKvt3e/b80bQoEeDMmqzeT5O21+vCWOBvreakgIYvK5fQti6oFGrVMHkmExiUjxeRXu5wnsjrL6vQen8D+6H3G3EcxGkTZj4TcDMep+X4qaJENeNieUModXrbU5ulGD4W SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2017 09:24:26.4258 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6021936c-1c62-416c-2b56-08d54c42759a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3148 Subject: [dpdk-dev] [PATCH v3 11/39] examples/kni: 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, 26 Dec 2017 09:24:28 -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/kni/main.c | 50 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/examples/kni/main.c b/examples/kni/main.c index 3f1738544..8ed838930 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -124,11 +124,8 @@ static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS]; /* Options for configuring ethernet port */ static struct rte_eth_conf port_conf = { .rxmode = { - .header_split = 0, /* Header Split disabled */ - .hw_ip_checksum = 0, /* IP checksum offload disabled */ - .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, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, @@ -607,11 +604,19 @@ init_port(uint16_t port) int ret; uint16_t nb_rxd = NB_RXD; uint16_t nb_txd = NB_TXD; + struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf rxq_conf; + struct rte_eth_txconf txq_conf; + struct rte_eth_conf local_port_conf = port_conf; /* Initialise device and RX/TX queues */ RTE_LOG(INFO, APP, "Initialising port %u ...\n", (unsigned)port); fflush(stdout); - ret = rte_eth_dev_configure(port, 1, 1, &port_conf); + rte_eth_dev_info_get(port, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + local_port_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MBUF_FAST_FREE; + ret = rte_eth_dev_configure(port, 1, 1, &local_port_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not configure port%u (%d)\n", (unsigned)port, ret); @@ -621,14 +626,19 @@ init_port(uint16_t port) rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors " "for port%u (%d)\n", (unsigned)port, ret); + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = local_port_conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(port, 0, nb_rxd, - rte_eth_dev_socket_id(port), NULL, pktmbuf_pool); + rte_eth_dev_socket_id(port), &rxq_conf, pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up RX queue for " "port%u (%d)\n", (unsigned)port, ret); + txq_conf = dev_info.default_txconf; + txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + txq_conf.offloads = local_port_conf.txmode.offloads; ret = rte_eth_tx_queue_setup(port, 0, nb_txd, - rte_eth_dev_socket_id(port), NULL); + rte_eth_dev_socket_id(port), &txq_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up TX queue for " "port%u (%d)\n", (unsigned)port, ret); @@ -702,7 +712,10 @@ static int kni_change_mtu(uint16_t port_id, unsigned int new_mtu) { int ret; + uint16_t nb_rxd = NB_RXD; struct rte_eth_conf conf; + struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf rxq_conf; if (port_id >= rte_eth_dev_count()) { RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id); @@ -717,9 +730,9 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) memcpy(&conf, &port_conf, sizeof(conf)); /* Set new MTU */ if (new_mtu > ETHER_MAX_LEN) - conf.rxmode.jumbo_frame = 1; + conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - conf.rxmode.jumbo_frame = 0; + conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; /* mtu + length of header + length of FCS = max pkt length */ conf.rxmode.max_rx_pkt_len = new_mtu + KNI_ENET_HEADER_SIZE + @@ -730,6 +743,23 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) return ret; } + ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, NULL); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors " + "for port%u (%d)\n", (unsigned int)port_id, + ret); + + rte_eth_dev_info_get(port_id, &dev_info); + rxq_conf = dev_info.default_rxconf; + rxq_conf.offloads = conf.rxmode.offloads; + ret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd, + rte_eth_dev_socket_id(port_id), &rxq_conf, pktmbuf_pool); + if (ret < 0) { + RTE_LOG(ERR, APP, "Fail to setup Rx queue of port %d\n", + port_id); + return ret; + } + /* Restart specific port */ ret = rte_eth_dev_start(port_id); if (ret < 0) { -- 2.12.0