From a062bafa62bbba1785bb7a180bb49bbac1818758 Mon Sep 17 00:00:00 2001 From: Hyong Youb Kim Date: Wed, 10 Jan 2018 01:17:03 -0800 Subject: [PATCH] net/enic: use the new ethdev offloads API The following commits deprecate the use of the offload bit fields (e.g. header_split) in rte_eth_rxmode and txq_flags in rte_eth_txconf. commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") For enic, the required changes are mechanical. Use the new 'offloads' field in rxmode instead of the bit fields. And, no changes required with respect to txq_flags, as enic does not use it at all. Per-queue RX offload capabilities are not set, as all offloads are per-port at the moment. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_ethdev.c | 9 ++++++--- drivers/net/enic/enic_main.c | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 669dbf3363..59834f3c83 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -370,7 +370,8 @@ static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) ENICPMD_FUNC_TRACE(); if (mask & ETH_VLAN_STRIP_MASK) { - if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip) + if (eth_dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) enic->ig_vlan_strip_en = 1; else enic->ig_vlan_strip_en = 0; @@ -407,13 +408,15 @@ static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev) } if (eth_dev->data->dev_conf.rxmode.split_hdr_size && - eth_dev->data->dev_conf.rxmode.header_split) { + (eth_dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_HEADER_SPLIT)) { /* Enable header-data-split */ enic_set_hdr_split_size(enic, eth_dev->data->dev_conf.rxmode.split_hdr_size); } - enic->hw_ip_checksum = eth_dev->data->dev_conf.rxmode.hw_ip_checksum; + enic->hw_ip_checksum = !!(eth_dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_CHECKSUM); ret = enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK); return ret; diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index a9509f0682..86ec08479f 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -634,7 +634,8 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx, mbuf_size = (uint16_t)(rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM); - if (enic->rte_dev->data->dev_conf.rxmode.enable_scatter) { + if (enic->rte_dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_SCATTER) { dev_info(enic, "Rq %u Scatter rx mode enabled\n", queue_idx); /* ceil((mtu + ETHER_HDR_LEN + 4)/mbuf_size) */ mbufs_per_pkt = ((mtu + ETHER_HDR_LEN + 4) + @@ -1208,7 +1209,8 @@ int enic_set_mtu(struct enic *enic, uint16_t new_mtu) /* The easy case is when scatter is disabled. However if the MTU * becomes greater than the mbuf data size, packet drops will ensue. */ - if (!enic->rte_dev->data->dev_conf.rxmode.enable_scatter) { + if (!(enic->rte_dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_SCATTER)) { eth_dev->data->mtu = new_mtu; goto set_mtu_done; } -- 2.20.1