[dpdk-dev,v2,30/39] examples/distributor: convert to new ethdev offloads API
Checks
Commit Message
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 <shahafs@mellanox.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
examples/distributor/main.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
@@ -108,9 +108,11 @@
.rxmode = {
.mq_mode = ETH_MQ_RX_RSS,
.max_rx_pkt_len = ETHER_MAX_LEN,
+ .ignore_offload_bitfield = 1,
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
+ .offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE,
},
.rx_adv_conf = {
.rss_conf = {
@@ -140,10 +142,28 @@ struct output_buffer {
uint16_t q;
uint16_t nb_rxd = RX_RING_SIZE;
uint16_t nb_txd = TX_RING_SIZE;
+ struct rte_eth_dev_info dev_info;
+ struct rte_eth_txconf txconf;
if (port >= rte_eth_dev_count())
return -1;
+ rte_eth_dev_info_get(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",
+ port, 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, port_conf.txmode.offloads,
+ dev_info.tx_offload_capa);
+ }
+
retval = rte_eth_dev_configure(port, rxRings, txRings, &port_conf);
if (retval != 0)
return retval;
@@ -160,10 +180,13 @@ struct output_buffer {
return retval;
}
+ txconf = dev_info.default_txconf;
+ txconf.txq_flags = ETH_TXQ_FLAGS_IGNORE;
+ txconf.offloads = port_conf.txmode.offloads;
for (q = 0; q < txRings; q++) {
retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port),
- NULL);
+ &txconf);
if (retval < 0)
return retval;
}