fm10k: reset and release mbuf for vector Tx
[dpdk.git] / drivers / net / fm10k / fm10k_rxtx.c
index b5fa2e6..1bac28d 100644 (file)
@@ -68,7 +68,6 @@ static inline void dump_rxd(union fm10k_rx_desc *rxd)
 static inline void
 rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
 {
-#ifdef RTE_NEXT_ABI
        static const uint32_t
                ptype_table[FM10K_RXD_PKTTYPE_MASK >> FM10K_RXD_PKTTYPE_SHIFT]
                        __rte_cache_aligned = {
@@ -91,14 +90,6 @@ rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
 
        m->packet_type = ptype_table[(d->w.pkt_info & FM10K_RXD_PKTTYPE_MASK)
                                                >> FM10K_RXD_PKTTYPE_SHIFT];
-#else /* RTE_NEXT_ABI */
-       uint16_t ptype;
-       static const uint16_t pt_lut[] = { 0,
-               PKT_RX_IPV4_HDR, PKT_RX_IPV4_HDR_EXT,
-               PKT_RX_IPV6_HDR, PKT_RX_IPV6_HDR_EXT,
-               0, 0, 0
-       };
-#endif /* RTE_NEXT_ABI */
 
        if (d->w.pkt_info & FM10K_RXD_RSSTYPE_MASK)
                m->ol_flags |= PKT_RX_RSS_HASH;
@@ -121,12 +112,6 @@ rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
 
        if (unlikely(d->d.staterr & FM10K_RXD_STATUS_RXE))
                m->ol_flags |= PKT_RX_RECIP_ERR;
-
-#ifndef RTE_NEXT_ABI
-       ptype = (d->d.data & FM10K_RXD_PKTTYPE_MASK_L3) >>
-                                               FM10K_RXD_PKTTYPE_SHIFT;
-       m->ol_flags |= pt_lut[(uint8_t)ptype];
-#endif
 }
 
 uint16_t
@@ -410,7 +395,7 @@ static inline void tx_free_descriptors(struct fm10k_tx_queue *q)
 static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 {
        uint16_t last_id;
-       uint8_t flags;
+       uint8_t flags, hdrlen;
 
        /* always set the LAST flag on the last descriptor used to
         * transmit the packet */
@@ -435,7 +420,7 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
        /* set checksum flags on first descriptor of packet. SCTP checksum
         * offload is not supported, but we do not explicitly check for this
         * case in favor of greatly simplified processing. */
-       if (mb->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK))
+       if (mb->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG))
                q->hw_ring[q->next_free].flags |= FM10K_TXD_FLAG_CSUM;
 
        /* set vlan if requested */
@@ -447,6 +432,21 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
                        rte_cpu_to_le_64(MBUF_DMA_ADDR(mb));
        q->hw_ring[q->next_free].buflen =
                        rte_cpu_to_le_16(rte_pktmbuf_data_len(mb));
+
+       if (mb->ol_flags & PKT_TX_TCP_SEG) {
+               hdrlen = mb->outer_l2_len + mb->outer_l3_len + mb->l2_len +
+                       mb->l3_len + mb->l4_len;
+               if (q->hw_ring[q->next_free].flags & FM10K_TXD_FLAG_FTAG)
+                       hdrlen += sizeof(struct fm10k_ftag);
+
+               if (likely((hdrlen >= FM10K_TSO_MIN_HEADERLEN) &&
+                               (hdrlen <= FM10K_TSO_MAX_HEADERLEN) &&
+                               (mb->tso_segsz >= FM10K_TSO_MINMSS))) {
+                       q->hw_ring[q->next_free].mss = mb->tso_segsz;
+                       q->hw_ring[q->next_free].hdrlen = hdrlen;
+               }
+       }
+
        if (++q->next_free == q->nb_desc)
                q->next_free = 0;
 
@@ -462,7 +462,7 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
                        q->next_free = 0;
        }
 
-       q->hw_ring[last_id].flags = flags;
+       q->hw_ring[last_id].flags |= flags;
 }
 
 uint16_t