New upstream version 16.11.5
[deb_dpdk.git] / drivers / net / ena / ena_ethdev.c
index 1fc3654..63c4236 100644 (file)
@@ -248,16 +248,17 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
                                       struct ena_com_rx_ctx *ena_rx_ctx)
 {
        uint64_t ol_flags = 0;
+       uint32_t packet_type = 0;
 
        if (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP)
-               ol_flags |= PKT_TX_TCP_CKSUM;
+               packet_type |= RTE_PTYPE_L4_TCP;
        else if (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)
-               ol_flags |= PKT_TX_UDP_CKSUM;
+               packet_type |= RTE_PTYPE_L4_UDP;
 
        if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4)
-               ol_flags |= PKT_TX_IPV4;
+               packet_type |= RTE_PTYPE_L3_IPV4;
        else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6)
-               ol_flags |= PKT_TX_IPV6;
+               packet_type |= RTE_PTYPE_L3_IPV6;
 
        if (unlikely(ena_rx_ctx->l4_csum_err))
                ol_flags |= PKT_RX_L4_CKSUM_BAD;
@@ -265,6 +266,7 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
                ol_flags |= PKT_RX_IP_CKSUM_BAD;
 
        mbuf->ol_flags = ol_flags;
+       mbuf->packet_type = packet_type;
 }
 
 static inline void ena_tx_mbuf_prepare(struct rte_mbuf *mbuf,
@@ -677,11 +679,10 @@ static void ena_rx_queue_release_bufs(struct ena_ring *ring)
 
 static void ena_tx_queue_release_bufs(struct ena_ring *ring)
 {
-       unsigned int ring_mask = ring->ring_size - 1;
+       unsigned int i;
 
-       while (ring->next_to_clean != ring->next_to_use) {
-               struct ena_tx_buffer *tx_buf =
-                       &ring->tx_buffer_info[ring->next_to_clean & ring_mask];
+       for (i = 0; i < ring->ring_size; ++i) {
+               struct ena_tx_buffer *tx_buf = &ring->tx_buffer_info[i];
 
                if (tx_buf->mbuf)
                        rte_pktmbuf_free(tx_buf->mbuf);
@@ -1683,6 +1684,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                /* Free whole mbuf chain  */
                mbuf = tx_info->mbuf;
                rte_pktmbuf_free(mbuf);
+               tx_info->mbuf = NULL;
 
                /* Put back descriptor to the ring for reuse */
                tx_ring->empty_tx_reqs[next_to_clean & ring_mask] = req_id;