mbuf: replace data pointer by an offset
[dpdk.git] / lib / librte_pmd_ixgbe / ixgbe_rxtx.c
index dc79c4b..c661335 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
+ *
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 #include "ixgbe_ethdev.h"
 #include "ixgbe/ixgbe_dcb.h"
 #include "ixgbe/ixgbe_common.h"
-
-
 #include "ixgbe_rxtx.h"
 
+#define IXGBE_RSS_OFFLOAD_ALL ( \
+               ETH_RSS_IPV4 | \
+               ETH_RSS_IPV4_TCP | \
+               ETH_RSS_IPV6 | \
+               ETH_RSS_IPV6_EX | \
+               ETH_RSS_IPV6_TCP | \
+               ETH_RSS_IPV6_TCP_EX | \
+               ETH_RSS_IPV4_UDP | \
+               ETH_RSS_IPV6_UDP | \
+               ETH_RSS_IPV6_UDP_EX)
 
 static inline struct rte_mbuf *
 rte_rxmbuf_alloc(struct rte_mempool *mp)
@@ -88,7 +96,7 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
        struct rte_mbuf *m;
 
        m = __rte_mbuf_raw_alloc(mp);
-       __rte_mbuf_sanity_check_raw(m, RTE_MBUF_PKT, 0);
+       __rte_mbuf_sanity_check_raw(m, 0);
        return (m);
 }
 
@@ -170,7 +178,7 @@ tx4(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts)
 
        for (i = 0; i < 4; ++i, ++txdp, ++pkts) {
                buf_dma_addr = RTE_MBUF_DATA_DMA_ADDR(*pkts);
-               pkt_len = (*pkts)->pkt.data_len;
+               pkt_len = (*pkts)->data_len;
 
                /* write data to descriptor */
                txdp->read.buffer_addr = buf_dma_addr;
@@ -189,7 +197,7 @@ tx1(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts)
        uint32_t pkt_len;
 
        buf_dma_addr = RTE_MBUF_DATA_DMA_ADDR(*pkts);
-       pkt_len = (*pkts)->pkt.data_len;
+       pkt_len = (*pkts)->data_len;
 
        /* write data to descriptor */
        txdp->read.buffer_addr = buf_dma_addr;
@@ -532,6 +540,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        volatile union ixgbe_adv_tx_desc *txd;
        struct rte_mbuf     *tx_pkt;
        struct rte_mbuf     *m_seg;
+       union ixgbe_vlan_macip vlan_macip_lens;
        uint64_t buf_dma_addr;
        uint32_t olinfo_status;
        uint32_t cmd_type_len;
@@ -543,7 +552,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        uint16_t nb_tx;
        uint16_t nb_used;
        uint16_t tx_ol_req;
-       uint32_t vlan_macip_lens;
        uint32_t ctx = 0;
        uint32_t new_ctx;
 
@@ -562,7 +570,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
                new_ctx = 0;
                tx_pkt = *tx_pkts++;
-               pkt_len = tx_pkt->pkt.pkt_len;
+               pkt_len = tx_pkt->pkt_len;
 
                RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
 
@@ -571,14 +579,15 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                 * are needed for offload functionality.
                 */
                ol_flags = tx_pkt->ol_flags;
-               vlan_macip_lens = tx_pkt->pkt.vlan_macip.data;
+               vlan_macip_lens.f.vlan_tci = tx_pkt->vlan_tci;
+               vlan_macip_lens.f.l2_l3_len = tx_pkt->l2_l3_len;
 
                /* If hardware offload required */
                tx_ol_req = (uint16_t)(ol_flags & PKT_TX_OFFLOAD_MASK);
                if (tx_ol_req) {
                        /* If new context need be built or reuse the exist ctx. */
                        ctx = what_advctx_update(txq, tx_ol_req,
-                               vlan_macip_lens);
+                               vlan_macip_lens.data);
                        /* Only allocate context descriptor if required*/
                        new_ctx = (ctx == IXGBE_CTX_NUM);
                        ctx = txq->ctx_curr;
@@ -589,7 +598,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                 * This will always be the number of segments + the number of
                 * Context descriptors required to transmit the packet
                 */
-               nb_used = (uint16_t)(tx_pkt->pkt.nb_segs + new_ctx);
+               nb_used = (uint16_t)(tx_pkt->nb_segs + new_ctx);
 
                /*
                 * The number of descriptors that must be allocated for a
@@ -720,7 +729,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                                }
 
                                ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
-                                   vlan_macip_lens);
+                                   vlan_macip_lens.data);
 
                                txe->last_id = tx_last;
                                tx_id = txe->next_id;
@@ -749,7 +758,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                        /*
                         * Set up Transmit Data Descriptor.
                         */
-                       slen = m_seg->pkt.data_len;
+                       slen = m_seg->data_len;
                        buf_dma_addr = RTE_MBUF_DATA_DMA_ADDR(m_seg);
                        txd->read.buffer_addr =
                                rte_cpu_to_le_64(buf_dma_addr);
@@ -760,7 +769,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                        txe->last_id = tx_last;
                        tx_id = txe->next_id;
                        txe = txn;
-                       m_seg = m_seg->pkt.next;
+                       m_seg = m_seg->next;
                } while (m_seg != NULL);
 
                /*
@@ -878,7 +887,7 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
 /*
  * LOOK_AHEAD defines how many desc statuses to check beyond the
- * current descriptor. 
+ * current descriptor.
  * It must be a pound define for optimal performance.
  * Do not change the value of LOOK_AHEAD, as the ixgbe_rx_scan_hw_ring
  * function only works with LOOK_AHEAD=8.
@@ -929,10 +938,10 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
                        mb = rxep[j].mbuf;
                        pkt_len = (uint16_t)(rxdp[j].wb.upper.length -
                                                        rxq->crc_len);
-                       mb->pkt.data_len = pkt_len;
-                       mb->pkt.pkt_len = pkt_len;
-                       mb->pkt.vlan_macip.f.vlan_tci = rxdp[j].wb.upper.vlan;
-                       mb->pkt.hash.rss = rxdp[j].wb.lower.hi_dword.rss;
+                       mb->data_len = pkt_len;
+                       mb->pkt_len = pkt_len;
+                       mb->vlan_tci = rxdp[j].wb.upper.vlan;
+                       mb->hash.rss = rxdp[j].wb.lower.hi_dword.rss;
 
                        /* convert descriptor fields to rte mbuf flags */
                        mb->ol_flags  = rx_desc_hlen_type_rss_to_pkt_flags(
@@ -987,11 +996,10 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
                /* populate the static rte mbuf fields */
                mb = rxep[i].mbuf;
                rte_mbuf_refcnt_set(mb, 1);
-               mb->type = RTE_MBUF_PKT;
-               mb->pkt.next = NULL;
-               mb->pkt.data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
-               mb->pkt.nb_segs = 1;
-               mb->pkt.in_port = rxq->port_id;
+               mb->next = NULL;
+               mb->data_off = RTE_PKTMBUF_HEADROOM;
+               mb->nb_segs = 1;
+               mb->port = rxq->port_id;
 
                /* populate the descriptors */
                dma_addr = (uint64_t)mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
@@ -1240,18 +1248,17 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                 */
                pkt_len = (uint16_t) (rte_le_to_cpu_16(rxd.wb.upper.length) -
                                      rxq->crc_len);
-               rxm->pkt.data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
-               rte_packet_prefetch(rxm->pkt.data);
-               rxm->pkt.nb_segs = 1;
-               rxm->pkt.next = NULL;
-               rxm->pkt.pkt_len = pkt_len;
-               rxm->pkt.data_len = pkt_len;
-               rxm->pkt.in_port = rxq->port_id;
+               rxm->data_off = RTE_PKTMBUF_HEADROOM;
+               rte_packet_prefetch((char *)rxm->buf_addr + rxm->data_off);
+               rxm->nb_segs = 1;
+               rxm->next = NULL;
+               rxm->pkt_len = pkt_len;
+               rxm->data_len = pkt_len;
+               rxm->port = rxq->port_id;
 
                hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
                /* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
-               rxm->pkt.vlan_macip.f.vlan_tci =
-                       rte_le_to_cpu_16(rxd.wb.upper.vlan);
+               rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
 
                pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
                pkt_flags = (uint16_t)(pkt_flags |
@@ -1261,12 +1268,12 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                rxm->ol_flags = pkt_flags;
 
                if (likely(pkt_flags & PKT_RX_RSS_HASH))
-                       rxm->pkt.hash.rss = rxd.wb.lower.hi_dword.rss;
+                       rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
                else if (pkt_flags & PKT_RX_FDIR) {
-                       rxm->pkt.hash.fdir.hash =
+                       rxm->hash.fdir.hash =
                                (uint16_t)((rxd.wb.lower.hi_dword.csum_ip.csum)
                                           & IXGBE_ATR_HASH_MASK);
-                       rxm->pkt.hash.fdir.id = rxd.wb.lower.hi_dword.csum_ip.ip_id;
+                       rxm->hash.fdir.id = rxd.wb.lower.hi_dword.csum_ip.ip_id;
                }
                /*
                 * Store the mbuf address into the next entry of the array
@@ -1423,8 +1430,8 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                 * Set data length & data buffer address of mbuf.
                 */
                data_len = rte_le_to_cpu_16(rxd.wb.upper.length);
-               rxm->pkt.data_len = data_len;
-               rxm->pkt.data = (char*) rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
+               rxm->data_len = data_len;
+               rxm->data_off = RTE_PKTMBUF_HEADROOM;
 
                /*
                 * If this is the first buffer of the received packet,
@@ -1436,13 +1443,13 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                 */
                if (first_seg == NULL) {
                        first_seg = rxm;
-                       first_seg->pkt.pkt_len = data_len;
-                       first_seg->pkt.nb_segs = 1;
+                       first_seg->pkt_len = data_len;
+                       first_seg->nb_segs = 1;
                } else {
-                       first_seg->pkt.pkt_len = (uint16_t)(first_seg->pkt.pkt_len
+                       first_seg->pkt_len = (uint16_t)(first_seg->pkt_len
                                        + data_len);
-                       first_seg->pkt.nb_segs++;
-                       last_seg->pkt.next = rxm;
+                       first_seg->nb_segs++;
+                       last_seg->next = rxm;
                }
 
                /*
@@ -1465,18 +1472,18 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                 *     mbuf, subtract the length of that CRC part from the
                 *     data length of the previous mbuf.
                 */
-               rxm->pkt.next = NULL;
+               rxm->next = NULL;
                if (unlikely(rxq->crc_len > 0)) {
-                       first_seg->pkt.pkt_len -= ETHER_CRC_LEN;
+                       first_seg->pkt_len -= ETHER_CRC_LEN;
                        if (data_len <= ETHER_CRC_LEN) {
                                rte_pktmbuf_free_seg(rxm);
-                               first_seg->pkt.nb_segs--;
-                               last_seg->pkt.data_len = (uint16_t)
-                                       (last_seg->pkt.data_len -
+                               first_seg->nb_segs--;
+                               last_seg->data_len = (uint16_t)
+                                       (last_seg->data_len -
                                         (ETHER_CRC_LEN - data_len));
-                               last_seg->pkt.next = NULL;
+                               last_seg->next = NULL;
                        } else
-                               rxm->pkt.data_len =
+                               rxm->data_len =
                                        (uint16_t) (data_len - ETHER_CRC_LEN);
                }
 
@@ -1489,14 +1496,13 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                 *      - VLAN TCI, if any,
                 *      - error flags.
                 */
-               first_seg->pkt.in_port = rxq->port_id;
+               first_seg->port = rxq->port_id;
 
                /*
                 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
                 * set in the pkt_flags field.
                 */
-               first_seg->pkt.vlan_macip.f.vlan_tci =
-                               rte_le_to_cpu_16(rxd.wb.upper.vlan);
+               first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
                hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
                pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
                pkt_flags = (uint16_t)(pkt_flags |
@@ -1506,17 +1512,18 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                first_seg->ol_flags = pkt_flags;
 
                if (likely(pkt_flags & PKT_RX_RSS_HASH))
-                       first_seg->pkt.hash.rss = rxd.wb.lower.hi_dword.rss;
+                       first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
                else if (pkt_flags & PKT_RX_FDIR) {
-                       first_seg->pkt.hash.fdir.hash =
+                       first_seg->hash.fdir.hash =
                                (uint16_t)((rxd.wb.lower.hi_dword.csum_ip.csum)
                                           & IXGBE_ATR_HASH_MASK);
-                       first_seg->pkt.hash.fdir.id =
+                       first_seg->hash.fdir.id =
                                rxd.wb.lower.hi_dword.csum_ip.ip_id;
                }
 
                /* Prefetch data of first segment, if configured to do so. */
-               rte_packet_prefetch(first_seg->pkt.data);
+               rte_packet_prefetch((char *)first_seg->buf_addr +
+                       first_seg->data_off);
 
                /*
                 * Store the mbuf address into the next entry of the array
@@ -1603,7 +1610,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
        char z_name[RTE_MEMZONE_NAMESIZE];
        const struct rte_memzone *mz;
 
-       rte_snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
+       snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
                        dev->driver->pci_drv.name, ring_name,
                        dev->data->port_id, queue_id);
 
@@ -1613,7 +1620,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
 
 #ifdef RTE_LIBRTE_XEN_DOM0
        return rte_memzone_reserve_bounded(z_name, ring_size,
-               socket_id, 0, IXGBE_ALIGN, RTE_PGSIZE_2M);
+               socket_id, 0, IXGBE_ALIGN, RTE_PGSIZE_2M);
 #else
        return rte_memzone_reserve_aligned(z_name, ring_size,
                socket_id, 0, IXGBE_ALIGN);
@@ -1638,7 +1645,7 @@ ixgbe_tx_queue_release_mbufs(struct igb_tx_queue *txq)
 static void
 ixgbe_tx_free_swring(struct igb_tx_queue *txq)
 {
-       if (txq != NULL && 
+       if (txq != NULL &&
            txq->sw_ring != NULL)
                rte_free(txq->sw_ring);
 }
@@ -1802,8 +1809,10 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
        }
 
        /* Free memory prior to re-allocation if needed... */
-       if (dev->data->tx_queues[queue_idx] != NULL)
+       if (dev->data->tx_queues[queue_idx] != NULL) {
                ixgbe_tx_queue_release(dev->data->tx_queues[queue_idx]);
+               dev->data->tx_queues[queue_idx] = NULL;
+       }
 
        /* First allocate the tx queue data structure */
        txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct igb_tx_queue),
@@ -1831,7 +1840,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
        txq->hthresh = tx_conf->tx_thresh.hthresh;
        txq->wthresh = tx_conf->tx_thresh.wthresh;
        txq->queue_id = queue_idx;
-       txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ? 
+       txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
                queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
        txq->port_id = dev->data->port_id;
        txq->txq_flags = tx_conf->txq_flags;
@@ -1845,7 +1854,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
                txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, IXGBE_VFTDT(queue_idx));
        else
                txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, IXGBE_TDT(txq->reg_idx));
-#ifndef        RTE_LIBRTE_XEN_DOM0 
+#ifndef        RTE_LIBRTE_XEN_DOM0
        txq->tx_ring_phys_addr = (uint64_t) tz->phys_addr;
 #else
        txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz->phys_addr);
@@ -2061,8 +2070,10 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
        }
 
        /* Free memory prior to re-allocation if needed... */
-       if (dev->data->rx_queues[queue_idx] != NULL)
+       if (dev->data->rx_queues[queue_idx] != NULL) {
                ixgbe_rx_queue_release(dev->data->rx_queues[queue_idx]);
+               dev->data->rx_queues[queue_idx] = NULL;
+       }
 
        /* First allocate the rx queue data structure */
        rxq = rte_zmalloc_socket("ethdev RX queue", sizeof(struct igb_rx_queue),
@@ -2073,7 +2084,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
        rxq->nb_rx_desc = nb_desc;
        rxq->rx_free_thresh = rx_conf->rx_free_thresh;
        rxq->queue_id = queue_idx;
-       rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ? 
+       rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
                queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
        rxq->port_id = dev->data->port_id;
        rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
@@ -2094,7 +2105,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
        }
 
        /*
-        * Zero init all the descriptors in the ring. 
+        * Zero init all the descriptors in the ring.
         */
        memset (rz->addr, 0, RX_RING_SZ);
 
@@ -2121,7 +2132,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
        rxq->rx_ring = (union ixgbe_adv_rx_desc *) rz->addr;
 
        /*
-        * Allocate software ring. Allow for space at the end of the 
+        * Allocate software ring. Allow for space at the end of the
         * S/W ring to make sure look-ahead logic in bulk alloc Rx burst
         * function does not access an invalid memory region.
         */
@@ -2156,7 +2167,8 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
                dev->rx_pkt_burst = ixgbe_recv_pkts_bulk_alloc;
 #ifdef RTE_IXGBE_INC_VECTOR
                if (!ixgbe_rx_vec_condition_check(dev)) {
-                       PMD_INIT_LOG(INFO, "Vector rx enabled.\n");
+                       PMD_INIT_LOG(INFO, "Vector rx enabled, please make "
+                                    "sure RX burst size no less than 32.\n");
                        ixgbe_rxq_vec_setup(rxq, socket_id);
                        dev->rx_pkt_burst = ixgbe_recv_pkts_vec;
                }
@@ -2299,7 +2311,7 @@ ixgbe_hw_rss_hash_set(struct ixgbe_hw *hw, struct rte_eth_rss_conf *rss_conf)
        uint8_t  *hash_key;
        uint32_t mrqc;
        uint32_t rss_key;
-       uint16_t rss_hf;
+       uint64_t rss_hf;
        uint16_t i;
 
        hash_key = rss_conf->rss_key;
@@ -2344,7 +2356,7 @@ ixgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
 {
        struct ixgbe_hw *hw;
        uint32_t mrqc;
-       uint16_t rss_hf;
+       uint64_t rss_hf;
 
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -2357,7 +2369,7 @@ ixgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
         * initialization time, or does not attempt to enable RSS, if RSS was
         * disabled at initialization time.
         */
-       rss_hf = rss_conf->rss_hf;
+       rss_hf = rss_conf->rss_hf & IXGBE_RSS_OFFLOAD_ALL;
        mrqc = IXGBE_READ_REG(hw, IXGBE_MRQC);
        if (!(mrqc & IXGBE_MRQC_RSSEN)) { /* RSS disabled */
                if (rss_hf != 0) /* Enable RSS */
@@ -2379,7 +2391,7 @@ ixgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
        uint8_t *hash_key;
        uint32_t mrqc;
        uint32_t rss_key;
-       uint16_t rss_hf;
+       uint64_t rss_hf;
        uint16_t i;
 
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2456,7 +2468,7 @@ ixgbe_rss_configure(struct rte_eth_dev *dev)
         * the RSS hash of input packets.
         */
        rss_conf = dev->data->dev_conf.rx_adv_conf.rss_conf;
-       if (rss_conf.rss_hf == 0) {
+       if ((rss_conf.rss_hf & IXGBE_RSS_OFFLOAD_ALL) == 0) {
                ixgbe_rss_disable(dev);
                return;
        }
@@ -2580,13 +2592,13 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)
  * @hw: pointer to hardware structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
-static void 
+static void
 ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
                struct ixgbe_dcb_config *dcb_config)
 {
        uint32_t reg;
        uint32_t q;
-       
+
        PMD_INIT_FUNC_TRACE();
        if (hw->mac.type != ixgbe_mac_82598EB) {
                /* Disable the Tx desc arbiter so that MTQC can be changed */
@@ -2634,21 +2646,21 @@ ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
 {
        struct rte_eth_vmdq_dcb_tx_conf *vmdq_tx_conf =
                        &dev->data->dev_conf.tx_adv_conf.vmdq_dcb_tx_conf;
-       struct ixgbe_hw *hw = 
+       struct ixgbe_hw *hw =
                        IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       
+
        PMD_INIT_FUNC_TRACE();
-       if (hw->mac.type != ixgbe_mac_82598EB)  
+       if (hw->mac.type != ixgbe_mac_82598EB)
                /*PF VF Transmit Enable*/
                IXGBE_WRITE_REG(hw, IXGBE_VFTE(0),
                        vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0xFFFF : 0xFFFFFFFF);
-    
+
        /*Configure general DCB TX parameters*/
        ixgbe_dcb_tx_hw_config(hw,dcb_config);
        return;
 }
 
-static void 
+static void
 ixgbe_vmdq_dcb_rx_config(struct rte_eth_dev *dev,
                         struct ixgbe_dcb_config *dcb_config)
 {
@@ -2675,15 +2687,15 @@ ixgbe_vmdq_dcb_rx_config(struct rte_eth_dev *dev,
        }
 }
 
-static void 
+static void
 ixgbe_dcb_vt_tx_config(struct rte_eth_dev *dev,
                         struct ixgbe_dcb_config *dcb_config)
-{ 
+{
        struct rte_eth_vmdq_dcb_tx_conf *vmdq_tx_conf =
                        &dev->data->dev_conf.tx_adv_conf.vmdq_dcb_tx_conf;
        struct ixgbe_dcb_tc_config *tc;
        uint8_t i,j;
-       
+
        /* convert rte_eth_conf.rx_adv_conf to struct ixgbe_dcb_config */
        if (vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ) {
                dcb_config->num_tcs.pg_tcs = ETH_8_TCS;
@@ -2704,7 +2716,7 @@ ixgbe_dcb_vt_tx_config(struct rte_eth_dev *dev,
        return;
 }
 
-static void 
+static void
 ixgbe_dcb_rx_config(struct rte_eth_dev *dev,
                struct ixgbe_dcb_config *dcb_config)
 {
@@ -2715,8 +2727,8 @@ ixgbe_dcb_rx_config(struct rte_eth_dev *dev,
 
        dcb_config->num_tcs.pg_tcs = (uint8_t)rx_conf->nb_tcs;
        dcb_config->num_tcs.pfc_tcs = (uint8_t)rx_conf->nb_tcs;
-       
-       /* User Priority to Traffic Class mapping */ 
+
+       /* User Priority to Traffic Class mapping */
        for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
                j = rx_conf->dcb_queue[i];
                tc = &dcb_config->tc_config[j];
@@ -2725,7 +2737,7 @@ ixgbe_dcb_rx_config(struct rte_eth_dev *dev,
        }
 }
 
-static void 
+static void
 ixgbe_dcb_tx_config(struct rte_eth_dev *dev,
                struct ixgbe_dcb_config *dcb_config)
 {
@@ -2736,8 +2748,8 @@ ixgbe_dcb_tx_config(struct rte_eth_dev *dev,
 
        dcb_config->num_tcs.pg_tcs = (uint8_t)tx_conf->nb_tcs;
        dcb_config->num_tcs.pfc_tcs = (uint8_t)tx_conf->nb_tcs;
-    
-       /* User Priority to Traffic Class mapping */ 
+
+       /* User Priority to Traffic Class mapping */
        for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
                j = tx_conf->dcb_queue[i];
                tc = &dcb_config->tc_config[j];
@@ -2797,7 +2809,7 @@ ixgbe_dcb_rx_hw_config(struct ixgbe_hw *hw,
        vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
        vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
+
        /* VFTA - enable all vlan filters */
        for (i = 0; i < NUM_VFTA_REGISTERS; i++) {
                IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
@@ -2809,11 +2821,11 @@ ixgbe_dcb_rx_hw_config(struct ixgbe_hw *hw,
         */
        reg = IXGBE_RTRPCS_RRM | IXGBE_RTRPCS_RAC;
        IXGBE_WRITE_REG(hw, IXGBE_RTRPCS, reg);
+
        return;
 }
 
-static void 
+static void
 ixgbe_dcb_hw_arbite_rx_config(struct ixgbe_hw *hw, uint16_t *refill,
                        uint16_t *max,uint8_t *bwg_id, uint8_t *tsa, uint8_t *map)
 {
@@ -2831,7 +2843,7 @@ ixgbe_dcb_hw_arbite_rx_config(struct ixgbe_hw *hw, uint16_t *refill,
        }
 }
 
-static void 
+static void
 ixgbe_dcb_hw_arbite_tx_config(struct ixgbe_hw *hw, uint16_t *refill, uint16_t *max,
                            uint8_t *bwg_id, uint8_t *tsa, uint8_t *map)
 {
@@ -2854,7 +2866,7 @@ ixgbe_dcb_hw_arbite_tx_config(struct ixgbe_hw *hw, uint16_t *refill, uint16_t *m
 #define DCB_TX_CONFIG  1
 #define DCB_TX_PB      1024
 /**
- * ixgbe_dcb_hw_configure - Enable DCB and configure 
+ * ixgbe_dcb_hw_configure - Enable DCB and configure
  * general DCB in VT mode and non-VT mode parameters
  * @dev: pointer to rte_eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
@@ -2874,8 +2886,8 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
        uint16_t max[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0};
        uint8_t map[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0};
        struct ixgbe_dcb_tc_config *tc;
-       uint32_t max_frame = dev->data->max_frame_size;
-       struct ixgbe_hw *hw = 
+       uint32_t max_frame = dev->data->mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+       struct ixgbe_hw *hw =
                        IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        switch(dev->data->dev_conf.rxmode.mq_mode){
@@ -2884,7 +2896,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
                if (hw->mac.type != ixgbe_mac_82598EB) {
                        config_dcb_rx = DCB_RX_CONFIG;
                        /*
-                        *get dcb and VT rx configuration parameters 
+                        *get dcb and VT rx configuration parameters
                         *from rte_eth_conf
                         */
                        ixgbe_vmdq_dcb_rx_config(dev,dcb_config);
@@ -2934,7 +2946,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
                /* Avoid un-configured priority mapping to TC0 */
                uint8_t j = 4;
                uint8_t mask = 0xFF;
-               for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES - 4; i++) 
+               for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES - 4; i++)
                        mask = (uint8_t)(mask & (~ (1 << map[i])));
                for (i = 0; mask && (i < IXGBE_DCB_MAX_TRAFFIC_CLASS); i++) {
                        if ((mask & 0x1) && (j < ETH_DCB_NUM_USER_PRIORITIES))
@@ -3042,14 +3054,14 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
 void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 {
        struct ixgbe_dcb_config *dcb_cfg =
-                       IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private); 
+                       IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);
        struct rte_eth_conf *dev_conf = &(dev->data->dev_conf);
-       
-       PMD_INIT_FUNC_TRACE();  
-       
+
+       PMD_INIT_FUNC_TRACE();
+
        /* check support mq_mode for DCB */
-       if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) && 
-           (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB)) 
+       if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
+           (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
                return;
 
        if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
@@ -3057,7 +3069,7 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 
        /** Configure DCB hardware **/
        ixgbe_dcb_hw_configure(dev,dcb_cfg);
-       
+
        return;
 }
 
@@ -3099,7 +3111,7 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
        /* VFTA - enable all vlan filters */
-       for (i = 0; i < NUM_VFTA_REGISTERS; i++) 
+       for (i = 0; i < NUM_VFTA_REGISTERS; i++)
                IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), UINT32_MAX);
 
        /* VFRE: pool enabling for receive - 64 */
@@ -3124,7 +3136,7 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
                 * pools, we only need to use the first half of the register
                 * i.e. bits 0-31
                 */
-               if (((cfg->pool_map[i].pools >> 32) & UINT32_MAX) == 0) 
+               if (((cfg->pool_map[i].pools >> 32) & UINT32_MAX) == 0)
                        IXGBE_WRITE_REG(hw, IXGBE_VLVFB(i*2), \
                                        (cfg->pool_map[i].pools & UINT32_MAX));
                else
@@ -3148,12 +3160,12 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
  * ixgbe_dcb_config_tx_hw_config - Configure general VMDq TX parameters
  * @hw: pointer to hardware structure
  */
-static void 
+static void
 ixgbe_vmdq_tx_hw_configure(struct ixgbe_hw *hw)
 {
        uint32_t reg;
        uint32_t q;
-       
+
        PMD_INIT_FUNC_TRACE();
        /*PF VF Transmit Enable*/
        IXGBE_WRITE_REG(hw, IXGBE_VFTE(0), UINT32_MAX);
@@ -3200,11 +3212,10 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
                }
 
                rte_mbuf_refcnt_set(mbuf, 1);
-               mbuf->type = RTE_MBUF_PKT;
-               mbuf->pkt.next = NULL;
-               mbuf->pkt.data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
-               mbuf->pkt.nb_segs = 1;
-               mbuf->pkt.in_port = rxq->port_id;
+               mbuf->next = NULL;
+               mbuf->data_off = RTE_PKTMBUF_HEADROOM;
+               mbuf->nb_segs = 1;
+               mbuf->port = rxq->port_id;
 
                dma_addr =
                        rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
@@ -3220,15 +3231,15 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 static int
 ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
 {
-       struct ixgbe_hw *hw = 
+       struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (hw->mac.type == ixgbe_mac_82598EB)
                return 0;
 
        if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
-               /* 
-                * SRIOV inactive scheme
+               /*
+                * SRIOV inactive scheme
                 * any DCB/RSS w/o VMDq multi-queue setting
                 */
                switch (dev->data->dev_conf.rxmode.mq_mode) {
@@ -3239,11 +3250,11 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
                        case ETH_MQ_RX_VMDQ_DCB:
                                ixgbe_vmdq_dcb_configure(dev);
                                break;
-       
+
                        case ETH_MQ_RX_VMDQ_ONLY:
                                ixgbe_vmdq_rx_hw_configure(dev);
                                break;
-                       
+
                        case ETH_MQ_RX_NONE:
                                /* if mq_mode is none, disable rss mode.*/
                        default: ixgbe_rss_disable(dev);
@@ -3261,7 +3272,7 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
                case ETH_32_POOLS:
                        IXGBE_WRITE_REG(hw, IXGBE_MRQC, IXGBE_MRQC_VMDQRT4TCEN);
                        break;
-               
+
                case ETH_16_POOLS:
                        IXGBE_WRITE_REG(hw, IXGBE_MRQC, IXGBE_MRQC_VMDQRT8TCEN);
                        break;
@@ -3276,7 +3287,7 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
 static int
 ixgbe_dev_mq_tx_configure(struct rte_eth_dev *dev)
 {
-       struct ixgbe_hw *hw = 
+       struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t mtqc;
        uint32_t rttdcs;
@@ -3290,10 +3301,10 @@ ixgbe_dev_mq_tx_configure(struct rte_eth_dev *dev)
        IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
 
        if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
-               /* 
-                * SRIOV inactive scheme
+               /*
+                * SRIOV inactive scheme
                 * any DCB w/o VMDq multi-queue setting
-                */
+                */
                if (dev->data->dev_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_ONLY)
                        ixgbe_vmdq_tx_hw_configure(hw);
                else {
@@ -3314,7 +3325,7 @@ ixgbe_dev_mq_tx_configure(struct rte_eth_dev *dev)
                        mtqc = IXGBE_MTQC_VT_ENA | IXGBE_MTQC_32VF;
                        break;
                case ETH_16_POOLS:
-                       mtqc = IXGBE_MTQC_VT_ENA | IXGBE_MTQC_RT_ENA | 
+                       mtqc = IXGBE_MTQC_VT_ENA | IXGBE_MTQC_RT_ENA |
                                IXGBE_MTQC_8TC_8TQ;
                        break;
                default:
@@ -3350,7 +3361,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
        uint32_t rxcsum;
        uint16_t buf_size;
        uint16_t i;
-       
+
        PMD_INIT_FUNC_TRACE();
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -3474,6 +3485,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
                }
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        /*
         * Device configured with multiple RX queues.
         */
@@ -3502,7 +3518,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
                rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
                IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
        }
-       
+
        return 0;
 }
 
@@ -3866,7 +3882,20 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
        PMD_INIT_FUNC_TRACE();
        hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       /* setup MTU */
+       /*
+        * When the VF driver issues a IXGBE_VF_RESET request, the PF driver
+        * disables the VF receipt of packets if the PF MTU is > 1500.
+        * This is done to deal with 82599 limitations that imposes
+        * the PF and all VFs to share the same MTU.
+        * Then, the PF driver enables again the VF receipt of packet when
+        * the VF driver issues a IXGBE_VF_SET_LPE request.
+        * In the meantime, the VF device cannot be used, even if the VF driver
+        * and the Guest VM network stack are ready to accept packets with a
+        * size up to the PF MTU.
+        * As a work-around to this PF behaviour, force the call to
+        * ixgbevf_rlpml_set_vf even if jumbo frames are not used. This way,
+        * VF packets received can work in all cases.
+        */
        ixgbevf_rlpml_set_vf(hw,
                (uint16_t)dev->data->dev_conf.rxmode.max_rx_pkt_len);
 
@@ -3949,6 +3978,11 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
                }
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        return 0;
 }