From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 363471E20 for ; Fri, 24 Nov 2017 16:01:00 +0100 (CET) Received: from pure.maildistiller.com (dispatch1.mdlocal [10.7.20.164]) by dispatch1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTP id 926E160EE5; Fri, 24 Nov 2017 15:00:59 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (us4-filterqueue.mdlocal [10.7.20.246]) by pure.maildistiller.com (Proofpoint Essentials ESMTP Server) with ESMTPS id E1C9180051; Fri, 24 Nov 2017 15:00:58 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 6BC58A80063; Fri, 24 Nov 2017 15:00:58 +0000 (UTC) Received: from [192.168.38.17] (84.52.114.114) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 24 Nov 2017 15:00:53 +0000 To: Shahaf Shuler , References: <20171123121419.144132-1-shahafs@mellanox.com> <20171123121419.144132-2-shahafs@mellanox.com> From: Andrew Rybchenko Message-ID: Date: Fri, 24 Nov 2017 18:00:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171123121419.144132-2-shahafs@mellanox.com> Content-Language: en-GB X-Originating-IP: [84.52.114.114] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23486.003 X-TM-AS-Result: No--19.465400-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1511535659-Rt4dEb+vcV9q Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 01/39] examples/l2fwd: 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: Fri, 24 Nov 2017 15:01:00 -0000 On 11/23/2017 03:14 PM, Shahaf Shuler wrote: > 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/l2fwd/main.c | 38 ++++++++++++++++++++++++++++++-------- > 1 file changed, 30 insertions(+), 8 deletions(-) > > diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c > index e89e2e1bf..a1e378be6 100644 > --- a/examples/l2fwd/main.c > +++ b/examples/l2fwd/main.c > @@ -110,14 +110,11 @@ struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE]; > > static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; > > -static const struct rte_eth_conf port_conf = { > +static struct rte_eth_conf port_conf = { > .rxmode = { > .split_hdr_size = 0, > - .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, It is not directly related to the patch. May be I miss something, but it looks like there is no way to say that "I always strip CRC and cannot preserve it". > }, > .txmode = { > .mq_mode = ETH_MQ_TX_NONE, > @@ -649,6 +646,9 @@ main(int argc, char **argv) > > /* Initialise each port */ > for (portid = 0; portid < nb_ports; portid++) { > + struct rte_eth_rxconf rxq_conf; > + struct rte_eth_txconf txq_conf; > + > /* skip ports that are not enabled */ > if ((l2fwd_enabled_port_mask & (1 << portid)) == 0) { > printf("Skipping disabled port %u\n", portid); > @@ -658,6 +658,23 @@ main(int argc, char **argv) > /* init port */ > printf("Initializing port %u... ", portid); > fflush(stdout); > + 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; > + } > ret = rte_eth_dev_configure(portid, 1, 1, &port_conf); > if (ret < 0) > rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n", > @@ -674,9 +691,11 @@ main(int argc, char **argv) > > /* init one RX queue */ > fflush(stdout); > + rxq_conf = dev_info.default_rxconf; > + rxq_conf.offloads = port_conf.rxmode.offloads; > ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, > rte_eth_dev_socket_id(portid), > - NULL, > + &rxq_conf, > l2fwd_pktmbuf_pool); > if (ret < 0) > rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", > @@ -684,9 +703,12 @@ main(int argc, char **argv) > > /* init one TX queue on each port */ > fflush(stdout); > + txq_conf = dev_info.default_txconf; > + txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; > + txq_conf.offloads = port_conf.txmode.offloads; It looks like it is not 100% equivalent. As far as I can see dev_info get does not convert txq_flags to offloads in default_txconf and in any case txq_conf.offloads are overwritten here. So, if PMD provides default txq_flags, it is lost. If it is intentionally, it should be highlighted and explained. > ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, > rte_eth_dev_socket_id(portid), > - NULL); > + &txq_conf); > if (ret < 0) > rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", > ret, portid);