net/avf: convert to new Rx and Tx offload API
authorWenzhuo Lu <wenzhuo.lu@intel.com>
Thu, 1 Mar 2018 06:41:46 +0000 (14:41 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Apr 2018 22:40:21 +0000 (00:40 +0200)
Ethdev Tx offloads API has changed since:
commit cba7f53b717d ("ethdev: introduce Tx queue offloads API")
This commit support the new Rx and Tx offloads API.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/avf/avf_ethdev.c
drivers/net/avf/avf_rxtx.c
drivers/net/avf/avf_rxtx.h

index 68a59b4..ff90065 100644 (file)
@@ -532,13 +532,13 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->default_rxconf = (struct rte_eth_rxconf) {
                .rx_free_thresh = AVF_DEFAULT_RX_FREE_THRESH,
                .rx_drop_en = 0,
+               .offloads = 0,
        };
 
        dev_info->default_txconf = (struct rte_eth_txconf) {
                .tx_free_thresh = AVF_DEFAULT_TX_FREE_THRESH,
                .tx_rs_thresh = AVF_DEFAULT_TX_RS_THRESH,
-               .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-                               ETH_TXQ_FLAGS_NOOFFLOADS,
+               .offloads = 0,
        };
 
        dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
@@ -759,7 +759,7 @@ avf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)
        /* Vlan stripping setting */
        if (mask & ETH_VLAN_STRIP_MASK) {
                /* Enable or disable VLAN stripping */
-               if (dev_conf->rxmode.hw_vlan_strip)
+               if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
                        err = avf_enable_vlan_strip(adapter);
                else
                        err = avf_disable_vlan_strip(adapter);
index d276d97..1824ed7 100644 (file)
@@ -109,7 +109,7 @@ check_rx_vec_allow(struct avf_rx_queue *rxq)
 static inline bool
 check_tx_vec_allow(struct avf_tx_queue *txq)
 {
-       if ((txq->txq_flags & AVF_SIMPLE_FLAGS) == AVF_SIMPLE_FLAGS &&
+       if (!(txq->offloads & AVF_NO_VECTOR_FLAGS) &&
            txq->rs_thresh >= AVF_VPMD_TX_MAX_BURST &&
            txq->rs_thresh <= AVF_VPMD_TX_MAX_FREE_BUF) {
                PMD_INIT_LOG(DEBUG, "Vector tx can be enabled on this txq.");
@@ -474,7 +474,7 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
        txq->free_thresh = tx_free_thresh;
        txq->queue_id = queue_idx;
        txq->port_id = dev->data->port_id;
-       txq->txq_flags = tx_conf->txq_flags;
+       txq->offloads = tx_conf->offloads;
        txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
        /* Allocate software ring */
@@ -1831,7 +1831,7 @@ avf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
        qinfo->conf.tx_free_thresh = txq->free_thresh;
        qinfo->conf.tx_rs_thresh = txq->rs_thresh;
-       qinfo->conf.txq_flags = txq->txq_flags;
+       qinfo->conf.offloads = txq->offloads;
        qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
 }
 
index d1701cd..297d077 100644 (file)
 #define AVF_VPMD_DESCS_PER_LOOP  4
 #define AVF_VPMD_TX_MAX_FREE_BUF 64
 
-#define AVF_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \
-                         ETH_TXQ_FLAGS_NOOFFLOADS)
+#define AVF_NO_VECTOR_FLAGS (                           \
+               DEV_TX_OFFLOAD_MULTI_SEGS |              \
+               DEV_TX_OFFLOAD_VLAN_INSERT |             \
+               DEV_TX_OFFLOAD_SCTP_CKSUM |              \
+               DEV_TX_OFFLOAD_UDP_CKSUM |               \
+               DEV_TX_OFFLOAD_TCP_CKSUM)
 
 #define DEFAULT_TX_RS_THRESH     32
 #define DEFAULT_TX_FREE_THRESH   32
@@ -125,7 +129,7 @@ struct avf_tx_queue {
 
        uint16_t port_id;
        uint16_t queue_id;
-       uint32_t txq_flags;
+       uint64_t offloads;
        uint16_t next_dd;              /* next to set RS, for VPMD */
        uint16_t next_rs;              /* next to check DD,  for VPMD */