Merge tag 'upstream/16.11.9' into 16.11.x
[deb_dpdk.git] / drivers / net / e1000 / igb_rxtx.c
index 4a987e3..4d11277 100644 (file)
@@ -56,7 +56,6 @@
 #include <rte_lcore.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
-#include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
 
 /* Bit Mask to indicate what bits required for building TX context */
 #define IGB_TX_OFFLOAD_MASK (                   \
+               PKT_TX_OUTER_IPV6 |      \
+               PKT_TX_OUTER_IPV4 |      \
+               PKT_TX_IPV6 |            \
+               PKT_TX_IPV4 |            \
                PKT_TX_VLAN_PKT |                \
                PKT_TX_IP_CKSUM |                \
                PKT_TX_L4_MASK |                 \
                PKT_TX_TCP_SEG)
 
-static inline struct rte_mbuf *
-rte_rxmbuf_alloc(struct rte_mempool *mp)
-{
-       struct rte_mbuf *m;
-
-       m = __rte_mbuf_raw_alloc(mp);
-       __rte_mbuf_sanity_check_raw(m, 0);
-       return m;
-}
-
 /**
  * Structure associated with each descriptor of the RX ring of a RX queue.
  */
@@ -739,7 +732,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status)
        uint64_t pkt_flags;
 
        /* Check if VLAN present */
-       pkt_flags = (rx_status & E1000_RXD_STAT_VP) ?  PKT_RX_VLAN_PKT : 0;
+       pkt_flags = ((rx_status & E1000_RXD_STAT_VP) ?
+               PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED : 0);
 
 #if defined(RTE_LIBRTE_IEEE1588)
        if (rx_status & E1000_RXD_STAT_TMST)
@@ -757,7 +751,9 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
         */
 
        static uint64_t error_to_pkt_flags_map[4] = {
-               0,  PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD,
+               PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD,
+               PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD,
+               PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD,
                PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
        };
        return error_to_pkt_flags_map[(rx_status >>
@@ -838,7 +834,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                           (unsigned) rx_id, (unsigned) staterr,
                           (unsigned) rte_le_to_cpu_16(rxd.wb.upper.length));
 
-               nmb = rte_rxmbuf_alloc(rxq->mb_pool);
+               nmb = rte_mbuf_raw_alloc(rxq->mb_pool);
                if (nmb == NULL) {
                        PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
                                   "queue_id=%u", (unsigned) rxq->port_id,
@@ -1021,7 +1017,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                           (unsigned) rx_id, (unsigned) staterr,
                           (unsigned) rte_le_to_cpu_16(rxd.wb.upper.length));
 
-               nmb = rte_rxmbuf_alloc(rxq->mb_pool);
+               nmb = rte_mbuf_raw_alloc(rxq->mb_pool);
                if (nmb == NULL) {
                        PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
                                   "queue_id=%u", (unsigned) rxq->port_id,
@@ -1537,7 +1533,7 @@ eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
                                desc - rxq->nb_rx_desc]);
        }
 
-       return 0;
+       return desc;
 }
 
 int
@@ -1957,7 +1953,7 @@ igb_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
        /* Initialize software ring entries. */
        for (i = 0; i < rxq->nb_rx_desc; i++) {
                volatile union e1000_adv_rx_desc *rxd;
-               struct rte_mbuf *mbuf = rte_rxmbuf_alloc(rxq->mb_pool);
+               struct rte_mbuf *mbuf = rte_mbuf_raw_alloc(rxq->mb_pool);
 
                if (mbuf == NULL) {
                        PMD_INIT_LOG(ERR, "RX mbuf alloc failed "
@@ -2187,9 +2183,11 @@ eth_igb_rx_init(struct rte_eth_dev *dev)
 
        /* Enable both L3/L4 rx checksum offload */
        if (dev->data->dev_conf.rxmode.hw_ip_checksum)
-               rxcsum |= (E1000_RXCSUM_IPOFL  | E1000_RXCSUM_TUOFL);
+               rxcsum |= (E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL |
+                               E1000_RXCSUM_CRCOFL);
        else
-               rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL);
+               rxcsum &= ~(E1000_RXCSUM_IPOFL | E1000_RXCSUM_TUOFL |
+                               E1000_RXCSUM_CRCOFL);
        E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum);
 
        /* Setup the Receive Control Register. */